Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
17 / 17 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| user_signature | |
100.00% |
17 / 17 |
|
100.00% |
3 / 3 |
4 | |
100.00% |
1 / 1 |
| add_missing_fields | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
2 | |||
| get_columns | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
1 | |||
| save_keyoptions | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| 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\textreparser\plugins; |
| 15 | |
| 16 | class user_signature extends \phpbb\textreparser\row_based_plugin |
| 17 | { |
| 18 | /** |
| 19 | * @var array Bit numbers used for user options |
| 20 | * @see \phpbb\user |
| 21 | */ |
| 22 | protected $keyoptions; |
| 23 | |
| 24 | /** |
| 25 | * {@inheritdoc} |
| 26 | */ |
| 27 | protected function add_missing_fields(array $record) |
| 28 | { |
| 29 | if (!isset($this->keyoptions)) |
| 30 | { |
| 31 | $this->save_keyoptions(); |
| 32 | } |
| 33 | |
| 34 | $options = $record['user_options']; |
| 35 | $record += array( |
| 36 | 'enable_bbcode' => phpbb_optionget($this->keyoptions['sig_bbcode'], $options), |
| 37 | 'enable_smilies' => phpbb_optionget($this->keyoptions['sig_smilies'], $options), |
| 38 | 'enable_magic_url' => phpbb_optionget($this->keyoptions['sig_links'], $options), |
| 39 | ); |
| 40 | |
| 41 | return parent::add_missing_fields($record); |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * {@inheritdoc} |
| 46 | */ |
| 47 | public function get_columns() |
| 48 | { |
| 49 | return array( |
| 50 | 'id' => 'user_id', |
| 51 | 'text' => 'user_sig', |
| 52 | 'bbcode_uid' => 'user_sig_bbcode_uid', |
| 53 | 'user_options' => 'user_options', |
| 54 | ); |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Save the keyoptions var from \phpbb\user |
| 59 | */ |
| 60 | protected function save_keyoptions() |
| 61 | { |
| 62 | $class_vars = get_class_vars('phpbb\\user'); |
| 63 | $this->keyoptions = $class_vars['keyoptions']; |
| 64 | } |
| 65 | } |