[ 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\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" max="99999" name="field_length" value="' . $field_data['field_length'] . '" />'), 33 1 => array('TITLE' => $this->user->lang['MIN_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_minlen" value="' . $field_data['field_minlen'] . '" />'), 34 2 => array('TITLE' => $this->user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_maxlen" 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_http') . '$#iu', $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 /** 76 * {@inheritDoc} 77 */ 78 public function get_profile_value($field_value, $field_data) 79 { 80 if (!preg_match('#^' . get_preg_expression('url_http') . '$#iu', $field_value)) 81 { 82 return null; 83 } 84 85 return parent::get_profile_value($field_value, $field_data); 86 } 87 }
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 |