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. |
|
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
ini.php
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\php;
015
016 /**
017 * Wrapper class for ini_get function.
018 *
019 * Provides easier handling of the different interpretations of ini values.
020 * @deprecated 3.2.10 (To be removed 4.0.0)
021 */
022 class ini
023 {
024 /**
025 * Simple wrapper for ini_get()
026 * See http://php.net/manual/en/function.ini-get.php
027 *
028 * @param string $varname The configuration option name.
029 * @return bool|string False if configuration option does not exist,
030 * the configuration option value (string) otherwise.
031 */
032 public function get($varname)
033 {
034 return ini_get($varname);
035 }
036
037 /**
038 * Gets the configuration option value as a trimmed string.
039 *
040 * @param string $varname The configuration option name.
041 * @return bool|string False if configuration option does not exist,
042 * the configuration option value (string) otherwise.
043 */
044 public function get_string($varname)
045 {
046 $value = $this->get($varname);
047
048 if ($value === false)
049 {
050 return false;
051 }
052
053 return trim($value);
054 }
055
056 /**
057 * Gets configuration option value as a boolean.
058 * Interprets the string value 'off' as false.
059 *
060 * @param string $varname The configuration option name.
061 * @return bool False if configuration option does not exist.
062 * False if configuration option is disabled.
063 * True otherwise.
064 */
065 public function get_bool($varname)
066 {
067 $value = $this->get_string($varname);
068
069 if (empty($value) || strtolower($value) == 'off')
070 {
071 return false;
072 }
073
074 return true;
075 }
076
077 /**
078 * Gets configuration option value as an integer.
079 *
080 * @param string $varname The configuration option name.
081 * @return bool|int False if configuration option does not exist,
082 * false if configuration option value is not numeric,
083 * the configuration option value (integer) otherwise.
084 */
085 public function get_int($varname)
086 {
087 $value = $this->get_string($varname);
088
089 if (!is_numeric($value))
090 {
091 return false;
092 }
093
094 return (int) $value;
095 }
096
097 /**
098 * Gets configuration option value as a float.
099 *
100 * @param string $varname The configuration option name.
101 * @return bool|float False if configuration option does not exist,
102 * false if configuration option value is not numeric,
103 * the configuration option value (float) otherwise.
104 */
105 public function get_float($varname)
106 {
107 $value = $this->get_string($varname);
108
109 if (!is_numeric($value))
110 {
111 return false;
112 }
113
114 return (float) $value;
115 }
116
117 /**
118 * Gets configuration option value in bytes.
119 * Converts strings like '128M' to bytes (integer or float).
120 *
121 * @param string $varname The configuration option name.
122 * @return bool|int|float False if configuration option does not exist,
123 * false if configuration option value is not well-formed,
124 * the configuration option value otherwise.
125 */
126 public function get_bytes($varname)
127 {
128 $value = $this->get_string($varname);
129
130 if ($value === false)
131 {
132 return false;
133 }
134
135 if (is_numeric($value))
136 {
137 // Already in bytes.
138 return phpbb_to_numeric($value);
139 }
140 else if (strlen($value) < 2)
141 {
142 // Single character.
143 return false;
144 }
145 else if (strlen($value) < 3 && $value[0] === '-')
146 {
147 // Two characters but the first one is a minus.
148 return false;
149 }
150
151 $value_lower = strtolower($value);
152 $value_numeric = phpbb_to_numeric($value);
153
154 switch ($value_lower[strlen($value_lower) - 1])
155 {
156 case 'g':
157 $value_numeric *= 1024;
158 case 'm':
159 $value_numeric *= 1024;
160 case 'k':
161 $value_numeric *= 1024;
162 break;
163
164 default:
165 // It's not already in bytes (and thus numeric)
166 // and does not carry a unit.
167 return false;
168 }
169
170 return $value_numeric;
171 }
172 }
173