Passed
Pull Request — master (#88)
by Michael
02:56
created

Constants   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 225
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 44
dl 0
loc 225
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

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