ggoffy /
wggithub
| 1 | <?php |
||
| 2 | /* |
||
| 3 | You may not change or alter any portion of this comment or credits |
||
| 4 | of supporting developers from this source code or any supporting source code |
||
| 5 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 6 | |||
| 7 | This program is distributed in the hope that it will be useful, |
||
| 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 10 | */ |
||
| 11 | |||
| 12 | /** |
||
| 13 | * wgGitHub module for xoops |
||
| 14 | * |
||
| 15 | * @copyright 2020 XOOPS Project (https://xooops.org) |
||
| 16 | * @license GPL 2.0 or later |
||
| 17 | * @package wggithub |
||
| 18 | * @since 1.0 |
||
| 19 | * @min_xoops 2.5.10 |
||
| 20 | * @author Goffy - XOOPS Development Team - Email:<[email protected]> - Website:<https://wedega.com> |
||
| 21 | */ |
||
| 22 | |||
| 23 | /** |
||
| 24 | * comment callback functions |
||
| 25 | * |
||
| 26 | * @param $category |
||
| 27 | * @param $item_id |
||
| 28 | * @return array item|null |
||
| 29 | */ |
||
| 30 | function wggithub_notify_iteminfo($category, $item_id) |
||
| 31 | {
|
||
| 32 | global $xoopsDB; |
||
| 33 | |||
| 34 | if (!\defined('WGGITHUB_URL')) {
|
||
| 35 | \define('WGGITHUB_URL', \XOOPS_URL . '/modules/wggithub');
|
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 36 | } |
||
| 37 | |||
| 38 | switch ($category) {
|
||
| 39 | case 'global': |
||
| 40 | $item['name'] = ''; |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
| 41 | $item['url'] = ''; |
||
| 42 | return $item; |
||
| 43 | break; |
||
|
0 ignored issues
–
show
break is not strictly necessary here and could be removed.
The switch ($x) {
case 1:
return 'foo';
break; // This break is not necessary and can be left off.
}
If you would like to keep this construct to be consistent with other Loading history...
|
|||
| 44 | case 'repositories': |
||
| 45 | $sql = 'SELECT repo_name FROM ' . $xoopsDB->prefix('wggithub_repositories') . ' WHERE repo_id = '. $item_id;
|
||
| 46 | $result = $xoopsDB->query($sql); |
||
| 47 | $result_array = $xoopsDB->fetchArray($result); |
||
| 48 | $item['name'] = $result_array['repo_name']; |
||
| 49 | $item['url'] = \WGGITHUB_URL . '/repositories.php?repo_id=' . $item_id; |
||
| 50 | return $item; |
||
| 51 | break; |
||
| 52 | } |
||
| 53 | return null; |
||
| 54 | } |
||
| 55 |