ggoffy /
wgsitenotice
| 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 | * wgSitenotice module for xoops |
||
| 13 | * |
||
| 14 | * @copyright XOOPS Project (https://xoops.org) |
||
| 15 | * @license GPL 2.0 or later |
||
| 16 | * @package wgsitenotice |
||
| 17 | * @since 1.0 |
||
| 18 | * @min_xoops 2.5.11 |
||
| 19 | * @author Goffy (wedega.com) - Email:<[email protected]> - Website:<https://xoops.wedega.com> |
||
| 20 | */ |
||
| 21 | |||
| 22 | use XoopsModules\Wgsitenotice\Helper; |
||
| 23 | |||
| 24 | include_once \XOOPS_ROOT_PATH.'/modules/wgsitenotice/include/common.php'; |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 25 | |||
| 26 | // Function show block |
||
| 27 | function b_wgsitenotice_versions_show($options) |
||
| 28 | { |
||
| 29 | |||
| 30 | $version_id = XoopsRequest::getInt('version_id'); |
||
|
0 ignored issues
–
show
The type
XoopsRequest was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 31 | |||
| 32 | $version = []; |
||
| 33 | $nb_versions = $options[0]; |
||
| 34 | $lenght_title = $options[1]; |
||
| 35 | $helper = Helper::getInstance(); |
||
| 36 | $versionsHandler = $helper->getHandler('Versions'); |
||
| 37 | $criteria = new \CriteriaCompo(); |
||
|
0 ignored issues
–
show
The type
CriteriaCompo was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 38 | \array_shift($options); |
||
| 39 | \array_shift($options); |
||
| 40 | $criteria->add(new \Criteria('version_current', 1)); |
||
|
0 ignored issues
–
show
The type
Criteria was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 41 | $criteria->setSort('version_weight'); |
||
| 42 | $criteria->setOrder('ASC'); |
||
| 43 | $version_count = $versionsHandler->getCount($criteria); |
||
| 44 | |||
| 45 | $criteria->setLimit($nb_versions); |
||
| 46 | $versions_arr = $versionsHandler->getAll($criteria); |
||
| 47 | $j = 0; |
||
| 48 | foreach (\array_keys($versions_arr) as $i) |
||
| 49 | { |
||
| 50 | $version[$i]['version_id'] = $versions_arr[$i]->getVar('version_id'); |
||
| 51 | $version_name = $versions_arr[$i]->getVar('version_name'); |
||
| 52 | if ($lenght_title > 0 && \strlen($version_name) > $lenght_title) { |
||
| 53 | $version_name = \substr($version_name, 0, $lenght_title) . '...'; |
||
| 54 | } |
||
| 55 | $version[$i]['version_name'] = $version_name; |
||
| 56 | $version[$i]['highlight'] = ($versions_arr[$i]->getVar('version_id') == $version_id); |
||
| 57 | $j++; |
||
| 58 | if ($j < $version_count) { |
||
| 59 | $version[$i]['show_more'] = $version_count; |
||
| 60 | } |
||
| 61 | } |
||
| 62 | return $version; |
||
| 63 | } |
||
| 64 | |||
| 65 | // Function edit block |
||
| 66 | function b_wgsitenotice_versions_edit($options) |
||
| 67 | { |
||
| 68 | |||
| 69 | $form = \_MB_WGSITENOTICE_DISPLAY; |
||
| 70 | $form .= "<input name='options[0]' size='5' maxlength='255' value='".$options[0]."' type='text' /> <br />"; |
||
| 71 | $form .= \_MB_WGSITENOTICE_TITLELENGTH." : <input name='options[1]' size='5' maxlength='255' value='".$options[1]."' type='text' /><br /><br />"; |
||
| 72 | \array_shift($options); |
||
| 73 | \array_shift($options); |
||
| 74 | |||
| 75 | return $form; |
||
| 76 | |||
| 77 | } |
||
| 78 |