mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-25 04:23:38 +01:00
[ticket/11201] Add abstract base class with shared methods
PHPBB3-11201
This commit is contained in:
parent
9653764fb1
commit
5e2ffe0d5c
52
phpBB/phpbb/profilefields/type/type_base.php
Normal file
52
phpBB/phpbb/profilefields/type/type_base.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB
|
||||
* @copyright (c) 2014 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\profilefields\type;
|
||||
|
||||
abstract class type_base implements type_interface
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function __construct(\phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user)
|
||||
{
|
||||
$this->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);
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace phpbb\profilefields\type;
|
||||
|
||||
class type_bool implements type_interface
|
||||
class type_bool extends type_base
|
||||
{
|
||||
/**
|
||||
*
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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}
|
||||
*/
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
{
|
||||
/**
|
||||
*
|
||||
|
@ -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}
|
||||
*/
|
||||
|
@ -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
|
||||
{
|
||||
/**
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user