Issues (525)

class/Contents.php (12 issues)

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 Contents
31
 */
32
class Contents 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('cont_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('cont_version_id', \XOBJ_DTYPE_INT);
44
        $this->initVar('cont_header', \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...
45
        $this->initVar('cont_text', \XOBJ_DTYPE_TXTAREA);
0 ignored issues
show
The constant XOBJ_DTYPE_TXTAREA was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
46
        $this->initVar('cont_weight', \XOBJ_DTYPE_INT);
47
        $this->initVar('cont_date', \XOBJ_DTYPE_INT);
48
        $this->initVar('dohtml', \XOBJ_DTYPE_INT, 1, false);
49
    }
50
51
    /**
52
     * @static function &getInstance
53
     * @param null
54
     * @return Contents
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
    /**
66
     * Get form
67
     *
68
     * @param mixed $action
69
     * @return \XoopsThemeForm
70
     */
71
    public function getForm($action = false)
72
    {
73
        $helper = Helper::getInstance();
74
        if (false === $action) {
75
            $action = $_SERVER['REQUEST_URI'];
76
        }
77
        // Title
78
        $title = $this->isNew() ? \sprintf(\_AM_WGSITENOTICE_CONTENT_ADD) : \sprintf(\_AM_WGSITENOTICE_CONTENT_EDIT);
79
        // Get Theme Form
80
        \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

80
        /** @scrutinizer ignore-call */ 
81
        \xoops_load('XoopsFormLoader');
Loading history...
81
        $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...
82
        $form->setExtra('enctype="multipart/form-data"');
83
        // Contents handler
84
        //$contentsHandler = $helper->getHandler('Contents');
85
        // Form Topic Contents
86
        $Handler = $helper->getHandler('Versions');
87
        $_select = new \XoopsFormSelect(\_AM_WGSITENOTICE_CONT_VERSION_ID, 'cont_version_id', $this->getVar('cont_version_id'));
0 ignored issues
show
The type XoopsFormSelect 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...
88
        $_select->addOptionArray($Handler->getList());
89
        $form->addElement( $_select );
90
        // Form cont_header
91
        $form->addElement( new \XoopsFormText(\_AM_WGSITENOTICE_CONT_HEADER, 'cont_header', 50, 255, $this->getVar('cont_header')), 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...
92
        // Form cont_text
93
        $editor_configs = [];
94
        $editor_configs['name'] = 'cont_text';
95
        $editor_configs['value'] = $this->getVar('cont_text', 'e');
96
        $editor_configs['rows'] = 5;
97
        $editor_configs['cols'] = 40;
98
        $editor_configs['width'] = '100%';
99
        $editor_configs['height'] = '400px';
100
        $editor_configs['editor'] = $helper->getConfig('wgsitenotice_editor');
101
        $form->addElement( new \XoopsFormEditor(\_AM_WGSITENOTICE_CONT_TEXT, 'cont_text', $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...
102
        // Form Text cont_weight
103
        $cont_weight = $this->isNew() ? 1 : $this->getVar('cont_weight');
104
        $form->addElement( new \XoopsFormText(\_AM_WGSITENOTICE_CONT_WEIGHT, 'cont_weight', 50, 255, $cont_weight), true );
105
        // Form Text Date Select
106
        //$form->addElement( new \XoopsFormTextDateSelect(\_AM_WGSITENOTICE_CONT_DATE, 'cont_date', '', $this->getVar('cont_date')), true );
107
        // Send
108
        $form->addElement(new \XoopsFormHidden('op', 'save'));
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...
109
        $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...
110
        return $form;
111
    }
112
}
113