Constants   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 196
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 52
c 0
b 0
f 0
dl 0
loc 196
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A mydirname() 0 6 2
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace XoopsModules\Tdmdownloads;
6
7
/*
8
 * You may not change or alter any portion of this comment or credits
9
 * of supporting developers from this source code or any supporting source code
10
 * which is considered copyrighted (c) material of the original comment or credit authors.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
 */
16
17
/**
18
 * @copyright    XOOPS Project https://xoops.org/
19
 * @license      GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
20
 * @package
21
 * @since
22
 * @author       XOOPS Development Team
23
 */
24
class Constants
25
{
26
    /**#@+
27
     * Constant definition
28
     */
29
    //    const MODULE_DIRNAME0 = basename(__DIR__);
30
    //    static $moddir = basename(dirname(__DIR__));
31
    public static $moduleDirName = null;
32
    public static $mydirname2    = null; //set in constructor
33
    public static $moduleUrl     = null;
34
    public static $modulePath    = null;
35
    public static $imagesUrl     = null;
36
    public static $imagesPath    = null;
37
    public static $adminUrl      = null;
38
    public static $adminPath     = null;
39
    public static $uploadsUrl    = null;
40
    public static $uploadsPath   = null;
41
    //    const ROOT = $_SERVER['DOCUMENT_ROOT']."project/";
42
    //    const MODULE_DIRNAME = basename(dirname(__DIR__));
43
    //    const MODULE_URL = XOOPS_URL . '/modules/' . self::MODULE_DIRNAME;
44
    //    const IMAGES_URL = PUBLISHER_URL . '/assets/images';
45
    //    const ADMIN_URL = PUBLISHER_URL . '/admin';
46
    //    const UPLOADS_URL = XOOPS_URL . '/uploads/' . self::MODULE_DIRNAME;
47
    //    const MODULE_PATH = XOOPS_ROOT_PATH . '/modules/' . self::MODULE_DIRNAME;
48
    //    const UPLOADS_PATH = XOOPS_ROOT_PATH . '/uploads/' . self::MODULE_DIRNAME;
49
50
    // common constants
51
    // constants for state
52
    const STATE_OFFLINE_VAL = 0;
53
    const STATE_ONLINE_VAL = 1;
54
    const STATE_APPROVAL_VAL = 2;
55
56
    // constants for rating
57
    const RATING_NONE = 0;
58
    const RATING_5STARS = 1;
59
    const RATING_10STARS = 2;
60
    const RATING_LIKES = 3;
61
    const RATING_10NUM = 4;
62
63
64
    //Application Folders (from xHelp module)
65
    /*
66
    define('BASE_PATH', XOOPS_ROOT_PATH.'/modules/'. XHELP_DIR_NAME);
67
    define('CLASS_PATH', XHELP_BASE_PATH.'/class');
68
    define('BASE_URL', XHELP_SITE_URL .'/modules/'. XHELP_DIR_NAME);
69
    define('UPLOAD_PATH', XOOPS_ROOT_PATH."/uploads/".XHELP_DIR_NAME);
70
    define('INCLUDE_PATH', XHELP_BASE_PATH.'/include');
71
    define('INCLUDE_URL', XHELP_BASE_URL.'/include');
72
    define('IMAGE_PATH', XHELP_BASE_PATH.'/images');
73
    define('IMAGE_URL', XHELP_BASE_URL.'/images');
74
    define('ADMIN_URL', XHELP_BASE_URL.'/admin');
75
    define('ADMIN_PATH', XHELP_BASE_PATH.'/admin');
76
    define('PEAR_PATH', XHELP_CLASS_PATH.'/pear');
77
    define('CACHE_PATH', XOOPS_ROOT_PATH.'/cache');
78
    define('CACHE_URL', XHELP_SITE_URL .'/cache');
79
    define('SCRIPT_URL', XHELP_BASE_URL.'/scripts');
80
    define('JPSPAN_PATH', XHELP_INCLUDE_PATH.'/jpspan');
81
    define('FAQ_ADAPTER_PATH', XHELP_CLASS_PATH.'/faq');
82
    define('REPORT_PATH', XHELP_BASE_PATH .'/reports');
83
    define('REPORT_URL', XHELP_BASE_URL .'/reports');
84
    define('JPGRAPH_PATH', XHELP_INCLUDE_PATH .'/jpgraph');
85
    define('JPGRAPH_URL', XHELP_INCLUDE_URL .'/jpgraph');
86
    define('RPT_RENDERER_PATH', XHELP_CLASS_PATH .'/reportRenderer');
87
    */
88
    /**
89
     *  do not allow
90
     */
91
    public const DISALLOW = 0;
92
    /**
93
     *  allow
94
     */
95
    public const ALLOW = 1;
96
    /**
97
     *  top level Category ID
98
     */
99
    public const ALLOW_MEMBERS = 2;
100
    /**
101
     *  top level Category ID
102
     */
103
    public const TOP_LEVEL_CID = 0;
104
    /**
105
     *  indicates default number of feed items to show
106
     */
107
    public const DEFAULT_FEED_COUNT = 10;
108
    /**
109
     *  maximum number of characters for feed description
110
     */
111
    public const MAX_FEED_DESC_COUNT = 1000;
112
    /**
113
     *  feed image height default
114
     */
115
    public const FEED_IMG_HEIGHT_DEFAULT = 31;
116
    /**
117
     *  feed image height maximum
118
     */
119
    public const FEED_IMG_HEIGHT_MAX = 400;
120
    /**
121
     *  feed image width default
122
     */
123
    public const FEED_IMG_WIDTH_DEFAULT = 88;
124
    /**
125
     *  feed image width maximum
126
     */
127
    public const FEED_IMG_WIDTH_MAX = 144;
128
    /**
129
     *  google magic used for page rank
130
     */
131
    public const GOOGLE_MAGIC = 0xE6359A60;
132
    /**
133
     *  anonymous user's ID
134
     */
135
    public const ANON_USER_ID = 0;
136
    /**
137
     *  default feed type
138
     */
139
    public const DEFAULT_FEED_TYPE = 'RSS';
140
    /**
141
     *  number of subcategories to display
142
     */
143
    public const SHOW_SUBCAT_COUNT = 5;
144
    /**
145
     * allow HTML in WYSIWYG editor
146
     */
147
    public const ALLOW_HTML = 1;
148
    /**
149
     * do not allow HTML in WYSIWYG editor
150
     */
151
    public const DISALLOW_HTML = 0;
152
    /**
153
     * no delay XOOPS redirect delay (in seconds)
154
     */
155
    public const REDIRECT_DELAY_NONE = 0;
156
    /**
157
     * short XOOPS redirect delay (in seconds)
158
     */
159
    public const REDIRECT_DELAY_SHORT = 1;
160
    /**
161
     * medium XOOPS redirect delay (in seconds)
162
     */
163
    public const REDIRECT_DELAY_MEDIUM = 3;
164
    /**
165
     * long XOOPS redirect delay (in seconds)
166
     */
167
    public const REDIRECT_DELAY_LONG = 7;
168
    /**
169
     * maximum acceptable rating
170
     */
171
    public const RATING_MAX = 10;
172
    /**
173
     * minimum acceptable rating
174
     */
175
    public const RATING_MIN = 1;
176
    /**
177
     * days between ratings from single IP
178
     */
179
    public const RATING_WAIT = 1;
180
    /**
181
     * sort list by popularity
182
     */
183
    public const SORT_BY_POPULARITY = 1;
184
    /**
185
     * sort list by rating
186
     */
187
    public const SORT_BY_RATING = 2;
188
    /**
189
     * sort list by most recent
190
     */
191
    public const SORT_BY_MOST_RECENT = 3;
192
    /**
193
     * link status - inactive
194
     */
195
    public const STATUS_INACTIVE = 0;
196
    /**
197
     * new link status
198
     */
199
    public const STATUS_NEW = 1;
200
    /**
201
     * modified link status
202
     */
203
    public const STATUS_UPDATED = 1;
204
205
    /**#@-*/
206
    public function __construct()
207
    {
208
        self::$mydirname2 = \basename(\dirname(__DIR__));
209
    }
210
211
    /**
212
     * @return null|string
213
     */
214
    public static function mydirname()
215
    {
216
        if (null === self::$moduleDirName) {
217
            self::$moduleDirName = \basename(\dirname(__DIR__));
218
        }
219
        return self::$moduleDirName;
220
    }
221
}
222