diff --git a/phpBB/phpbb/profilefields/type/type_base.php b/phpBB/phpbb/profilefields/type/type_base.php new file mode 100644 index 0000000000..00e8d74327 --- /dev/null +++ b/phpBB/phpbb/profilefields/type/type_base.php @@ -0,0 +1,52 @@ +request = $request; + $this->template = $template; + $this->user = $user; + } + + /** + * {@inheritDoc} + */ + public function get_field_ident($field_data) + { + return 'pf_' . $field_data['field_ident']; + } + + /** + * {@inheritDoc} + */ + public function get_language_options_input($field_data) + { + $field_data['l_lang_name'] = $this->request->variable('l_lang_name', array(0 => ''), true); + $field_data['l_lang_explain'] = $this->request->variable('l_lang_explain', array(0 => ''), true); + $field_data['l_lang_default_value'] = $this->request->variable('l_lang_default_value', array(0 => ''), true); + $field_data['l_lang_options'] = $this->request->variable('l_lang_options', array(0 => ''), true); + + return $field_data; + } + + /** + * {@inheritDoc} + */ + public function prepare_options_form(&$exclude_options, &$visibility_options) + { + return $this->request->variable('lang_options', '', true); + } +} diff --git a/phpBB/phpbb/profilefields/type/type_bool.php b/phpBB/phpbb/profilefields/type/type_bool.php index f27c5af1ee..4cfd147ea2 100644 --- a/phpBB/phpbb/profilefields/type/type_bool.php +++ b/phpBB/phpbb/profilefields/type/type_bool.php @@ -9,7 +9,7 @@ namespace phpbb\profilefields\type; -class type_bool implements type_interface +class type_bool extends type_base { /** * diff --git a/phpBB/phpbb/profilefields/type/type_date.php b/phpBB/phpbb/profilefields/type/type_date.php index 37b8db2779..a2c9111351 100644 --- a/phpBB/phpbb/profilefields/type/type_date.php +++ b/phpBB/phpbb/profilefields/type/type_date.php @@ -9,7 +9,7 @@ namespace phpbb\profilefields\type; -class type_date implements type_interface +class type_date extends type_base { /** * @@ -258,25 +258,4 @@ class type_date implements type_interface return $options; } - - /** - * {@inheritDoc} - */ - public function get_language_options_input($field_data) - { - $field_data['l_lang_name'] = $this->request->variable('l_lang_name', array(0 => ''), true); - $field_data['l_lang_explain'] = $this->request->variable('l_lang_explain', array(0 => ''), true); - $field_data['l_lang_default_value'] = $this->request->variable('l_lang_default_value', array(0 => ''), true); - $field_data['l_lang_options'] = $this->request->variable('l_lang_options', array(0 => ''), true); - - return $field_data; - } - - /** - * {@inheritDoc} - */ - public function prepare_options_form(&$exclude_options, &$visibility_options) - { - return $this->request->variable('lang_options', '', true); - } } diff --git a/phpBB/phpbb/profilefields/type/type_dropdown.php b/phpBB/phpbb/profilefields/type/type_dropdown.php index 25671c88fa..2119443a7a 100644 --- a/phpBB/phpbb/profilefields/type/type_dropdown.php +++ b/phpBB/phpbb/profilefields/type/type_dropdown.php @@ -9,7 +9,7 @@ namespace phpbb\profilefields\type; -class type_dropdown implements type_interface +class type_dropdown extends type_base { /** * @@ -176,14 +176,6 @@ class type_dropdown implements type_interface } } - /** - * {@inheritDoc} - */ - public function get_field_ident($field_data) - { - return 'pf_' . $field_data['field_ident']; - } - /** * {@inheritDoc} */ @@ -210,19 +202,6 @@ class type_dropdown implements type_interface return $options; } - /** - * {@inheritDoc} - */ - public function get_language_options_input($field_data) - { - $field_data['l_lang_name'] = $this->request->variable('l_lang_name', array(0 => ''), true); - $field_data['l_lang_explain'] = $this->request->variable('l_lang_explain', array(0 => ''), true); - $field_data['l_lang_default_value'] = $this->request->variable('l_lang_default_value', array(0 => ''), true); - $field_data['l_lang_options'] = $this->request->variable('l_lang_options', array(0 => ''), true); - - return $field_data; - } - /** * {@inheritDoc} */ diff --git a/phpBB/phpbb/profilefields/type/type_int.php b/phpBB/phpbb/profilefields/type/type_int.php index 35f021f0fa..2cd9d3b2c4 100644 --- a/phpBB/phpbb/profilefields/type/type_int.php +++ b/phpBB/phpbb/profilefields/type/type_int.php @@ -9,7 +9,7 @@ namespace phpbb\profilefields\type; -class type_int implements type_interface +class type_int extends type_base { /** * @@ -183,25 +183,4 @@ class type_int implements type_interface return $options; } - - /** - * {@inheritDoc} - */ - public function get_language_options_input($field_data) - { - $field_data['l_lang_name'] = $this->request->variable('l_lang_name', array(0 => ''), true); - $field_data['l_lang_explain'] = $this->request->variable('l_lang_explain', array(0 => ''), true); - $field_data['l_lang_default_value'] = $this->request->variable('l_lang_default_value', array(0 => ''), true); - $field_data['l_lang_options'] = $this->request->variable('l_lang_options', array(0 => ''), true); - - return $field_data; - } - - /** - * {@inheritDoc} - */ - public function prepare_options_form(&$exclude_options, &$visibility_options) - { - return $this->request->variable('lang_options', '', true); - } } diff --git a/phpBB/phpbb/profilefields/type/type_string.php b/phpBB/phpbb/profilefields/type/type_string.php index ee2eb8b760..66157ddc20 100644 --- a/phpBB/phpbb/profilefields/type/type_string.php +++ b/phpBB/phpbb/profilefields/type/type_string.php @@ -9,7 +9,7 @@ namespace phpbb\profilefields\type; -class type_string extends type_string_common implements type_interface +class type_string extends type_string_common { /** * diff --git a/phpBB/phpbb/profilefields/type/type_string_common.php b/phpBB/phpbb/profilefields/type/type_string_common.php index a6145e910b..d322099c34 100644 --- a/phpBB/phpbb/profilefields/type/type_string_common.php +++ b/phpBB/phpbb/profilefields/type/type_string_common.php @@ -9,7 +9,7 @@ namespace phpbb\profilefields\type; -abstract class type_string_common +abstract class type_string_common extends type_base { /** * Return possible validation options @@ -102,27 +102,6 @@ abstract class type_string_common return $field_value; } - /** - * {@inheritDoc} - */ - public function get_field_ident($field_data) - { - return 'pf_' . $field_data['field_ident']; - } - - /** - * {@inheritDoc} - */ - public function get_language_options_input($field_data) - { - $field_data['l_lang_name'] = $this->request->variable('l_lang_name', array(0 => ''), true); - $field_data['l_lang_explain'] = $this->request->variable('l_lang_explain', array(0 => ''), true); - $field_data['l_lang_default_value'] = $this->request->variable('l_lang_default_value', array(0 => ''), true); - $field_data['l_lang_options'] = $this->request->variable('l_lang_options', array(0 => ''), true); - - return $field_data; - } - /** * {@inheritDoc} */ diff --git a/phpBB/phpbb/profilefields/type/type_text.php b/phpBB/phpbb/profilefields/type/type_text.php index 7aea982f6f..309ed88818 100644 --- a/phpBB/phpbb/profilefields/type/type_text.php +++ b/phpBB/phpbb/profilefields/type/type_text.php @@ -9,7 +9,7 @@ namespace phpbb\profilefields\type; -class type_text extends type_string_common implements type_interface +class type_text extends type_string_common { /** *