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 | |
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
4 files changed, 71 insertions, 0 deletions
diff --git a/phpBB/config/profilefields.yml b/phpBB/config/profilefields.yml index 00f025e141..ce2a84b12b 100644 --- a/phpBB/config/profilefields.yml +++ b/phpBB/config/profilefields.yml @@ -55,6 +55,15 @@ services: tags: - { name: profilefield.type } + profilefields.type.googleplus: + class: phpbb\profilefields\type\type_googleplus + arguments: + - @request + - @template + - @user + tags: + - { name: profilefield.type } + profilefields.type.int: class: phpbb\profilefields\type\type_int arguments: 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; + } +} diff --git a/phpBB/styles/prosilver/template/profilefields/googleplus.html b/phpBB/styles/prosilver/template/profilefields/googleplus.html new file mode 100644 index 0000000000..cf457d39ad --- /dev/null +++ b/phpBB/styles/prosilver/template/profilefields/googleplus.html @@ -0,0 +1,3 @@ +<!-- BEGIN string --> +<input type="text" class="inputbox autowidth" name="{string.FIELD_IDENT}" id="{string.FIELD_IDENT}" size="{string.FIELD_LENGTH}" maxlength="{string.FIELD_MAXLEN}" value="{string.FIELD_VALUE}" /> +<!-- END string --> diff --git a/phpBB/styles/subsilver2/template/profilefields/googleplus.html b/phpBB/styles/subsilver2/template/profilefields/googleplus.html new file mode 100644 index 0000000000..5a98562e2a --- /dev/null +++ b/phpBB/styles/subsilver2/template/profilefields/googleplus.html @@ -0,0 +1,3 @@ +<!-- BEGIN string --> + <input type="text" class="post" name="{string.FIELD_IDENT}" size="{string.FIELD_LENGTH}" maxlength="{string.FIELD_MAXLEN}" value="{string.FIELD_VALUE}" /> +<!-- END string --> |