Issues (525)

class/Versions.php (11 issues)

Languages
Labels
Severity
1
<?php
2
3
namespace XoopsModules\Wgsitenotice;
4
5
/*
6
 You may not change or alter any portion of this comment or credits
7
 of supporting developers from this source code or any supporting source code
8
 which is considered copyrighted (c) material of the original comment or credit authors.
9
10
 This program is distributed in the hope that it will be useful,
11
 but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
*/
14
/**
15
 * wgSitenotice module for xoops
16
 *
17
 * @copyright       XOOPS Project (https://xoops.org)
18
 * @license         GPL 2.0 or later
19
 * @package         wgsitenotice
20
 * @since           1.0
21
 * @min_xoops       2.5.11
22
 * @author          Goffy (xoops.wedega.com) - Email:<[email protected]> - Website:<https://xoops.wedega.com>
23
 */
24
25
use XoopsModules\Wgsitenotice\Helper;
26
27
\defined('XOOPS_ROOT_PATH') || exit('Restricted access');
28
29
/*
30
 * Class Object Versions
31
 */
32
class Versions extends \XoopsObject
0 ignored issues
show
The type XoopsObject 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
33
{
34
35
    /**
36
     * Constructor
37
     *
38
     * @param null
39
     */
40
    public function __construct()
41
    {
42
        $this->initVar('version_id', \XOBJ_DTYPE_INT);
0 ignored issues
show
The constant XOBJ_DTYPE_INT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
43
        $this->initVar('version_name', \XOBJ_DTYPE_TXTBOX);
0 ignored issues
show
The constant XOBJ_DTYPE_TXTBOX was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
44
        $this->initVar('version_lang', \XOBJ_DTYPE_TXTBOX);
45
        $this->initVar('version_descr', \XOBJ_DTYPE_TXTBOX);
46
        $this->initVar('version_author', \XOBJ_DTYPE_TXTBOX);
47
        $this->initVar('version_weight', \XOBJ_DTYPE_INT);
48
        $this->initVar('version_current', \XOBJ_DTYPE_INT);
49
        $this->initVar('version_online', \XOBJ_DTYPE_INT);
50
        $this->initVar('version_date', \XOBJ_DTYPE_INT);
51
    }
52
    /*
53
    *  @static function &getInstance
54
    *  @param null
55
    */
56
    public static function getInstance()
57
    {
58
        static $instance;
59
        if (null === $instance) {
60
            $instance = new static();
61
        }
62
        return $instance;
63
    }
64
    /*
65
     * Get form
66
     *
67
     * @param mixed $action
68
     */
69
    public function getForm($action = false)
70
    {
71
        $helper = Helper::getInstance();
72
73
        if (false === $action) {
74
            $action = $_SERVER['REQUEST_URI'];
75
        }
76
        // Title
77
        $title = $this->isNew() ? \sprintf(\_AM_WGSITENOTICE_VERSION_ADD) : \sprintf(\_AM_WGSITENOTICE_VERSION_EDIT);
78
        // Get Theme Form
79
        \xoops_load('XoopsFormLoader');
0 ignored issues
show
The function xoops_load was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

79
        /** @scrutinizer ignore-call */ 
80
        \xoops_load('XoopsFormLoader');
Loading history...
80
        $form = new \XoopsThemeForm($title, 'form', $action, 'post', true);
0 ignored issues
show
The type XoopsThemeForm 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
81
        $form->setExtra('enctype="multipart/form-data"');
82
        // Form Text version_name
83
        $form->addElement( new \XoopsFormText(\_AM_WGSITENOTICE_VERSION_NAME, 'version_name', 50, 255, $this->getVar('version_name')), true );
0 ignored issues
show
The type XoopsFormText 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
84
        // Form Text version_lang
85
        $form->addElement( new \XoopsFormText(\_AM_WGSITENOTICE_VERSION_LANG, 'version_lang', 50, 255, $this->getVar('version_lang')) );
86
        // Form Text Area
87
        // Form Dhtml Text Area
88
        $editor_configs = [];
89
        $editor_configs['name'] = 'version_descr';
90
        $editor_configs['value'] = $this->getVar('version_descr', 'e');
91
        $editor_configs['rows'] = 5;
92
        $editor_configs['cols'] = 40;
93
        $editor_configs['width'] = '100%';
94
        $editor_configs['height'] = '400px';
95
        $editor_configs['editor'] = $helper->getConfig('wgsitenotice_editor');
96
        $form->addElement( new \XoopsFormEditor(\_AM_WGSITENOTICE_VERSION_DESCR, 'version_descr', $editor_configs) );
0 ignored issues
show
The type XoopsFormEditor 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
97
        // Form Text version_author
98
        $version_author = $this->isNew() ? $GLOBALS['xoopsUser']->getVar('uname') : $this->getVar('version_author');
99
        $form->addElement( new \XoopsFormText(\_AM_WGSITENOTICE_VERSION_AUTHOR, 'version_author', 50, 255, $version_author) );
100
        // Form Text version_weight
101
        $form->addElement( new \XoopsFormHidden('version_weight', $this->getVar('version_weight')) );
0 ignored issues
show
The type XoopsFormHidden 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
102
        // Form Radio Yes/No version_current
103
        $version_current = $this->isNew() ? 0 : $this->getVar('version_current');
104
        $form->addElement( new \XoopsFormRadioYN(\_AM_WGSITENOTICE_VERSION_CURRENT, 'version_current', $version_current), true );
0 ignored issues
show
The type XoopsFormRadioYN 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
105
        // Form Radio Yes/No
106
        $version_online = $this->isNew() ? 0 : $this->getVar('version_online');
107
        $form->addElement( new \XoopsFormRadioYN(\_AM_WGSITENOTICE_VERSION_ONLINE, 'version_online', $version_online), true );
108
        // Form Text Date Select
109
        //$form->addElement( new \XoopsFormTextDateSelect(\_AM_WGSITENOTICE_VERSION_DATE, 'version_date', '', $this->getVar('version_date')), true );
110
        // Send
111
        $form->addElement(new \XoopsFormHidden('op', 'save'));
112
        $form->addElement(new \XoopsFormButtonTray('', \_SUBMIT, 'submit', '', false));
0 ignored issues
show
The type XoopsFormButtonTray 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
The constant _SUBMIT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
113
        return $form;
114
    }
115
}
116