Passed
Push — master ( 93b609...1da0d9 )
by Michael
37s
created

ModuleConstants::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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