iMattPro /
TopicImagePreview
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * |
||
| 4 | * Topic Image Preview. An extension for the phpBB Forum Software package. |
||
| 5 | * |
||
| 6 | * @copyright (c) 2017, Matt Friedman |
||
| 7 | * @license GNU General Public License, version 2 (GPL-2.0) |
||
| 8 | * |
||
| 9 | */ |
||
| 10 | |||
| 11 | namespace vse\TopicImagePreview; |
||
| 12 | |||
| 13 | class ext extends \phpbb\extension\base |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * {@inheritdoc} |
||
| 17 | */ |
||
| 18 | public function is_enableable() |
||
| 19 | { |
||
| 20 | // Requires phpBB 3.2.0 or newer. |
||
| 21 | $is_enableable = phpbb_version_compare(PHPBB_VERSION, '3.2.0', '>='); |
||
| 22 | |||
| 23 | // Display a custom warning message if requirement fails. |
||
| 24 | if (!$is_enableable) |
||
| 25 | { |
||
| 26 | $lang = $this->container->get('language'); |
||
| 27 | $lang->add_lang('tip_acp', 'vse/TopicImagePreview'); |
||
| 28 | |||
| 29 | // Suppress the error in case of CLI usage |
||
| 30 | @trigger_error($lang->lang('ACP_TIP_INSTALL_ERROR'), E_USER_WARNING); |
||
|
0 ignored issues
–
show
|
|||
| 31 | } |
||
| 32 | |||
| 33 | return $is_enableable; |
||
| 34 | } |
||
| 35 | } |
||
| 36 |
If you suppress an error, we recommend checking for the error condition explicitly: