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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
type_url.php
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\profilefields\type;
15
16 class type_url extends type_string
17 {
18 /**
19 * {@inheritDoc}
20 */
21 public function get_name_short()
22 {
23 return 'url';
24 }
25
26 /**
27 * {@inheritDoc}
28 */
29 public function get_options($default_lang_id, $field_data)
30 {
31 $options = array(
32 0 => array('TITLE' => $this->user->lang['FIELD_LENGTH'], 'FIELD' => '<input type="number" min="0" name="field_length" size="5" value="' . $field_data['field_length'] . '" />'),
33 1 => array('TITLE' => $this->user->lang['MIN_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" name="field_minlen" size="5" value="' . $field_data['field_minlen'] . '" />'),
34 2 => array('TITLE' => $this->user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" name="field_maxlen" size="5" value="' . $field_data['field_maxlen'] . '" />'),
35 );
36
37 return $options;
38 }
39
40 /**
41 * {@inheritDoc}
42 */
43 public function get_default_option_values()
44 {
45 return array(
46 'field_length' => 40,
47 'field_minlen' => 0,
48 'field_maxlen' => 200,
49 'field_validation' => '',
50 'field_novalue' => '',
51 'field_default_value' => '',
52 );
53 }
54
55 /**
56 * {@inheritDoc}
57 */
58 public function validate_profile_field(&$field_value, $field_data)
59 {
60 $field_value = trim($field_value);
61
62 if ($field_value === '' && !$field_data['field_required'])
63 {
64 return false;
65 }
66
67 if (!preg_match('#^' . get_preg_expression('url') . '$#i', $field_value))
68 {
69 return $this->user->lang('FIELD_INVALID_URL', $this->get_field_name($field_data['lang_name']));
70 }
71
72 return false;
73 }
74 }
75