diff options
author | Shitiz Garg <mail@dragooon.net> | 2014-06-18 19:34:14 +0530 |
---|---|---|
committer | Shitiz Garg <mail@dragooon.net> | 2014-06-21 03:29:31 +0530 |
commit | 3cebb18ce8e8e97a6b95b32dbab5740489c840ea (patch) | |
tree | 3373026e5eabaed5d91811c20ce868e8e686711c /phpBB/phpbb/profilefields | |
parent | 18bf45ab1b3f07fbed5c7d566766170ff0a71e8e (diff) | |
download | forums-3cebb18ce8e8e97a6b95b32dbab5740489c840ea.tar forums-3cebb18ce8e8e97a6b95b32dbab5740489c840ea.tar.gz forums-3cebb18ce8e8e97a6b95b32dbab5740489c840ea.tar.bz2 forums-3cebb18ce8e8e97a6b95b32dbab5740489c840ea.tar.xz forums-3cebb18ce8e8e97a6b95b32dbab5740489c840ea.zip |
[ticket/12730] Add Google+ profile field type
Google+ has a "+" before a custom URL but doesn't for those which are using
their integer ID. To cover that we need to have an extra profile field
PHPBB3-12730
Diffstat (limited to 'phpBB/phpbb/profilefields')
-rw-r--r-- | phpBB/phpbb/profilefields/type/type_googleplus.php | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/phpBB/phpbb/profilefields/type/type_googleplus.php b/phpBB/phpbb/profilefields/type/type_googleplus.php new file mode 100644 index 0000000000..1bdb04e859 --- /dev/null +++ b/phpBB/phpbb/profilefields/type/type_googleplus.php @@ -0,0 +1,56 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\profilefields\type; + +class type_googleplus extends type_string +{ + /** + * {@inheritDoc} + */ + public function get_name_short() + { + return 'googleplus'; + } + + /** + * {@inheritDoc} + */ + public function get_default_option_values() + { + return array( + 'field_length' => 20, + 'field_minlen' => 3, + 'field_maxlen' => '', + 'field_validation' => '[\w]+', + 'field_novalue' => '', + 'field_default_value' => '', + ); + } + + /** + * {@inheritDoc} + */ + public function get_profile_contact_value($field_value, $field_data) + { + if (!$field_value && !$field_data['field_show_novalue']) + { + return null; + } + + if (!is_numeric($field_value)) + $field_value = '+' . $field_value; + + return $field_value; + } +} |