|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* JPGraph - Community Edition |
|
5
|
|
|
*/ |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* // File: config.inc.php |
|
9
|
|
|
* // Description: Configuration constants and settings for JpGraph library |
|
10
|
|
|
* // Created: 2004-03-27 |
|
11
|
|
|
* // Ver: $Id: jpg-config.inc.php 1871 2009-09-29 05:56:39Z ljp $. |
|
12
|
|
|
* // |
|
13
|
|
|
* // Copyright (c) Asial Corporation. All rights reserved. |
|
14
|
|
|
*/ |
|
15
|
|
|
|
|
16
|
|
|
// check if jpgraph is the root folder |
|
17
|
1 |
|
if (\file_exists(\dirname(__DIR__) . '/vendor/autoload.php')) { |
|
18
|
1 |
|
\defined('ROOT_PATH') || \define('ROOT_PATH', \dirname(__DIR__)); |
|
19
|
|
|
} elseif (\file_exists(\dirname(__DIR__, 4) . '/vendor/autoload.php')) { |
|
20
|
|
|
// otherwise, jpgraph was required as a composer dependency |
|
21
|
|
|
\defined('ROOT_PATH') || \define('ROOT_PATH', \dirname(__DIR__, 4)); |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
1 |
|
require_once ROOT_PATH . '/vendor/autoload.php'; |
|
25
|
|
|
|
|
26
|
|
|
use Amenadiel\JpGraph\Util\ErrMsgText; |
|
27
|
|
|
|
|
28
|
1 |
|
if (\is_readable(ROOT_PATH . '/.env') && \class_exists('\Symfony\Component\Dotenv\Dotenv')) { |
|
29
|
|
|
$dotenv = new \Symfony\Component\Dotenv\Dotenv(); |
|
30
|
|
|
$dotenv->load(ROOT_PATH . '/.env'); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
1 |
|
if (\getenv('JPGRAPH_DEBUGMODE') && !\defined('DEBUGMODE')) { |
|
34
|
|
|
\define('DEBUGMODE', \getenv('JPGRAPH_DEBUGMODE')); |
|
35
|
|
|
} |
|
36
|
|
|
// Sets DEBUGMODE for the app. Set this to true to enable debugging outputs |
|
37
|
1 |
|
\defined('DEBUGMODE') || \define('DEBUGMODE', false); |
|
38
|
|
|
|
|
39
|
1 |
|
\ini_set('display_errors', (int) DEBUGMODE); |
|
40
|
1 |
|
\ini_set('display_startup_errors', (int) DEBUGMODE); |
|
41
|
|
|
|
|
42
|
1 |
|
if (DEBUGMODE) { |
|
43
|
|
|
\error_reporting(\E_ALL); |
|
44
|
|
|
} |
|
45
|
1 |
|
require_once __DIR__ . '/includes/polyfills.php'; |
|
46
|
|
|
/* |
|
47
|
|
|
* Directories for cache and font directory. |
|
48
|
|
|
* Define these constants explicitly or read them from environment vars |
|
49
|
|
|
* |
|
50
|
|
|
* CACHE_DIR: |
|
51
|
|
|
* The full absolute name of the directory to be used to store the |
|
52
|
|
|
* cached image files. This directory will not be used if the USE_CACHE |
|
53
|
|
|
* define (further down) is false. If you enable the cache please note that |
|
54
|
|
|
* this directory MUST be readable and writable for the process running PHP. |
|
55
|
|
|
* Must end with '/' |
|
56
|
|
|
* |
|
57
|
|
|
* TTF_DIR: |
|
58
|
|
|
* Directory where TTF fonts can be found. Must end with '/' |
|
59
|
|
|
* |
|
60
|
|
|
* The default values used if these defines are left commented out are: |
|
61
|
|
|
* |
|
62
|
|
|
* UNIX: |
|
63
|
|
|
* CACHE_DIR /tmp/jpgraph_cache/ |
|
64
|
|
|
* TTF_DIR /usr/share/fonts/truetype/ |
|
65
|
|
|
* MBTTF_DIR /usr/share/fonts/truetype/ |
|
66
|
|
|
* |
|
67
|
|
|
* WINDOWS: |
|
68
|
|
|
* CACHE_DIR $SERVER_TEMP/jpgraph_cache/ |
|
69
|
|
|
* TTF_DIR $SERVER_SYSTEMROOT/fonts/ |
|
70
|
|
|
* MBTTF_DIR $SERVER_SYSTEMROOT/fonts/ |
|
71
|
|
|
* |
|
72
|
|
|
*/ |
|
73
|
|
|
|
|
74
|
|
|
// Define these constants explicitly |
|
75
|
|
|
// define('CACHE_DIR','/tmp/jpgraph_cache/'); |
|
76
|
|
|
// define('TTF_DIR','/usr/share/fonts/TrueType/'); |
|
77
|
|
|
// define('MBTTF_DIR','/usr/share/fonts/TrueType/'); |
|
78
|
|
|
// |
|
79
|
|
|
// Or read them from environment variables |
|
80
|
1 |
|
if (\getenv('JPGRAPH_CACHE_DIR')) { |
|
81
|
|
|
\define('CACHE_DIR', \getenv('JPGRAPH_CACHE_DIR')); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
1 |
|
if (\getenv('JPGRAPH_TTF_DIR')) { |
|
85
|
|
|
\define('TTF_DIR', \getenv('JPGRAPH_TTF_DIR')); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
1 |
|
if (\getenv('JPGRAPH_MBTTF_DIR')) { |
|
89
|
|
|
\define('MBTTF_DIR', \getenv('JPGRAPH_MBTTF_DIR')); |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
/* |
|
93
|
|
|
* Cache directory specification for use with CSIM graphs that are |
|
94
|
|
|
* // using the cache. |
|
95
|
|
|
* // The directory must be the filesysystem name as seen by PHP |
|
96
|
|
|
* // and the 'http' version must be the same directory but as |
|
97
|
|
|
* // seen by the HTTP server relative to the 'htdocs' ddirectory. |
|
98
|
|
|
* // If a relative path is specified it is taken to be relative from where |
|
99
|
|
|
* // the image script is executed. |
|
100
|
|
|
* // Note: The default setting is to create a subdirectory in the |
|
101
|
|
|
* // directory from where the image script is executed and store all files |
|
102
|
|
|
* // there. As ususal this directory must be writeable by the PHP process. |
|
103
|
|
|
*/ |
|
104
|
1 |
|
\define('CSIMCACHE_DIR', 'csimcache/'); |
|
105
|
1 |
|
\define('CSIMCACHE_HTTP_DIR', 'csimcache/'); |
|
106
|
|
|
|
|
107
|
|
|
/* |
|
108
|
|
|
* Various JpGraph Settings. Adjust accordingly to your |
|
109
|
|
|
* // preferences. Note that cache functionality is turned off by |
|
110
|
|
|
* // default (Enable by setting USE_CACHE to true) |
|
111
|
|
|
*/ |
|
112
|
|
|
// Deafult locale for error messages. |
|
113
|
|
|
// This defaults to English = 'en' |
|
114
|
1 |
|
\define('DEFAULT_ERR_LOCALE', 'en'); |
|
115
|
|
|
|
|
116
|
|
|
// Deafult graphic format set to 'auto' which will automatically |
|
117
|
|
|
// choose the best available format in the order png,gif,jpeg |
|
118
|
|
|
// (The supported format depends on what your PHP installation supports) |
|
119
|
1 |
|
\define('DEFAULT_GFORMAT', 'auto'); |
|
120
|
|
|
|
|
121
|
|
|
// Should the cache be used at all? By setting this to false no |
|
122
|
|
|
// files will be generated in the cache directory. |
|
123
|
|
|
// The difference from READ_CACHE being that setting READ_CACHE to |
|
124
|
|
|
// false will still create the image in the cache directory |
|
125
|
|
|
// just not use it. By setting USE_CACHE=false no files will even |
|
126
|
|
|
// be generated in the cache directory. |
|
127
|
1 |
|
if (!\defined('USE_CACHE')) { |
|
128
|
1 |
|
\define('USE_CACHE', \getenv('JPGRAPH_USE_CACHE') ?: false); |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
// Should we try to find an image in the cache before generating it? |
|
132
|
|
|
// Set this define to false to bypass the reading of the cache and always |
|
133
|
|
|
// regenerate the image. Note that even if reading the cache is |
|
134
|
|
|
// disabled the cached will still be updated with the newly generated |
|
135
|
|
|
// image. Set also 'USE_CACHE' below. |
|
136
|
1 |
|
if (!\defined('READ_CACHE')) { |
|
137
|
1 |
|
\define('READ_CACHE', true); |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
// Determine if the error handler should be image based or purely |
|
141
|
|
|
// text based. Image based makes it easier since the script will |
|
142
|
|
|
// always return an image even in case of errors. |
|
143
|
1 |
|
\define('USE_IMAGE_ERROR_HANDLER', true); |
|
144
|
|
|
|
|
145
|
|
|
// Should the library examine the global php_errmsg string and convert |
|
146
|
|
|
// any error in it to a graphical representation. This is handy for the |
|
147
|
|
|
// occasions when, for example, header files cannot be found and this results |
|
148
|
|
|
// in the graph not being created and just a 'red-cross' image would be seen. |
|
149
|
|
|
// This should be turned off for a production site. |
|
150
|
1 |
|
\define('CATCH_PHPERRMSG', true); |
|
151
|
|
|
|
|
152
|
|
|
// Determine if the library should also setup the default PHP |
|
153
|
|
|
// error handler to generate a graphic error mesage. This is useful |
|
154
|
|
|
// during development to be able to see the error message as an image |
|
155
|
|
|
// instead as a 'red-cross' in a page where an image is expected. |
|
156
|
1 |
|
\define('INSTALL_PHP_ERR_HANDLER', false); |
|
157
|
|
|
|
|
158
|
|
|
// Should usage of deprecated functions and parameters give a fatal error? |
|
159
|
|
|
// (Useful to check if code is future proof.) |
|
160
|
1 |
|
\define('ERR_DEPRECATED', true); |
|
161
|
|
|
|
|
162
|
|
|
// The builtin GD function imagettfbbox() fuction which calculates the bounding box for |
|
163
|
|
|
// text using TTF fonts is buggy. By setting this define to true the library |
|
164
|
|
|
// uses its own compensation for this bug. However this will give a |
|
165
|
|
|
// slightly different visual apparance than not using this compensation. |
|
166
|
|
|
// Enabling this compensation will in general give text a bit more space to more |
|
167
|
|
|
// truly reflect the actual bounding box which is a bit larger than what the |
|
168
|
|
|
// GD function thinks. |
|
169
|
1 |
|
\define('USE_LIBRARY_IMAGETTFBBOX', true); |
|
170
|
|
|
|
|
171
|
|
|
/* |
|
172
|
|
|
* The following constants should rarely have to be changed ! |
|
173
|
|
|
*/ |
|
174
|
|
|
// What group should the cached file belong to |
|
175
|
|
|
// (Set to '' will give the default group for the 'PHP-user') |
|
176
|
|
|
// Please note that the Apache user must be a member of the |
|
177
|
|
|
// specified group since otherwise it is impossible for Apache |
|
178
|
|
|
// to set the specified group. |
|
179
|
1 |
|
\define('CACHE_FILE_GROUP', 'www'); |
|
180
|
|
|
|
|
181
|
|
|
// What permissions should the cached file have |
|
182
|
|
|
// (Set to '' will give the default persmissions for the 'PHP-user') |
|
183
|
1 |
|
\define('CACHE_FILE_MOD', 0664); |
|
184
|
|
|
|
|
185
|
|
|
// Default theme class name |
|
186
|
1 |
|
\defined('DEFAULT_THEME_CLASS') || \define('DEFAULT_THEME_CLASS', 'UniversalTheme'); |
|
187
|
|
|
|
|
188
|
1 |
|
\define('SUPERSAMPLING', true); |
|
189
|
1 |
|
\define('SUPERSAMPLING_SCALE', 1); |
|
190
|
|
|
|
|
191
|
|
|
// TTF Font families |
|
192
|
1 |
|
\define('FF_COURIER', 10); |
|
193
|
1 |
|
\define('FF_VERDANA', 11); |
|
194
|
1 |
|
\define('FF_TIMES', 12); |
|
195
|
1 |
|
\define('FF_COMIC', 14); |
|
196
|
1 |
|
\define('FF_ARIAL', 15); |
|
197
|
1 |
|
\define('FF_GEORGIA', 16); |
|
198
|
1 |
|
\define('FF_TREBUCHE', 17); |
|
199
|
|
|
|
|
200
|
|
|
// Gnome Vera font |
|
201
|
|
|
// Available from http://www.gnome.org/fonts/ |
|
202
|
1 |
|
\define('FF_VERA', 18); |
|
203
|
1 |
|
\define('FF_VERAMONO', 19); |
|
204
|
1 |
|
\define('FF_VERASERIF', 20); |
|
205
|
|
|
|
|
206
|
|
|
// Chinese font |
|
207
|
1 |
|
\define('FF_SIMSUN', 30); |
|
208
|
1 |
|
\define('FF_CHINESE', 31); |
|
209
|
1 |
|
\define('FF_BIG5', 32); |
|
210
|
|
|
|
|
211
|
|
|
// Japanese font |
|
212
|
1 |
|
\define('FF_MINCHO', 40); |
|
213
|
1 |
|
\define('FF_PMINCHO', 41); |
|
214
|
1 |
|
\define('FF_GOTHIC', 42); |
|
215
|
1 |
|
\define('FF_PGOTHIC', 43); |
|
216
|
|
|
|
|
217
|
|
|
// Hebrew fonts |
|
218
|
1 |
|
\define('FF_DAVID', 44); |
|
219
|
1 |
|
\define('FF_MIRIAM', 45); |
|
220
|
1 |
|
\define('FF_AHRON', 46); |
|
221
|
|
|
|
|
222
|
|
|
// Dejavu-fonts http://sourceforge.net/projects/dejavu |
|
223
|
1 |
|
\define('FF_DV_SANSSERIF', 47); |
|
224
|
1 |
|
\define('FF_DV_SERIF', 48); |
|
225
|
1 |
|
\define('FF_DV_SANSSERIFMONO', 49); |
|
226
|
1 |
|
\define('FF_DV_SERIFCOND', 50); |
|
227
|
1 |
|
\define('FF_DV_SANSSERIFCOND', 51); |
|
228
|
|
|
|
|
229
|
|
|
// Extra fonts |
|
230
|
|
|
// Download fonts from |
|
231
|
|
|
// http://www.webfontlist.com |
|
232
|
|
|
// http://www.webpagepublicity.com/free-fonts.html |
|
233
|
|
|
// http://www.fontonic.com/fonts.asp?width=d&offset=120 |
|
234
|
|
|
// http://www.fontspace.com/category/famous |
|
235
|
|
|
|
|
236
|
|
|
// define("FF_SPEEDO",71); // This font is also known as Bauer (Used for development gauge fascia) |
|
237
|
1 |
|
\define('FF_DIGITAL', 72); // Digital readout font |
|
238
|
1 |
|
\define('FF_COMPUTER', 73); // The classic computer font |
|
239
|
1 |
|
\define('FF_CALCULATOR', 74); // Triad font |
|
240
|
|
|
|
|
241
|
1 |
|
\define('FF_USERFONT', 90); |
|
242
|
1 |
|
\define('FF_USERFONT1', 90); |
|
243
|
1 |
|
\define('FF_USERFONT2', 91); |
|
244
|
1 |
|
\define('FF_USERFONT3', 92); |
|
245
|
|
|
|
|
246
|
|
|
// Limits for fonts |
|
247
|
1 |
|
\define('_FIRST_FONT', 10); |
|
248
|
1 |
|
\define('_LAST_FONT', 99); |
|
249
|
|
|
|
|
250
|
|
|
// TTF Font styles |
|
251
|
1 |
|
\define('FS_NORMAL', 9001); |
|
252
|
1 |
|
\define('FS_BOLD', 9002); |
|
253
|
1 |
|
\define('FS_ITALIC', 9003); |
|
254
|
1 |
|
\define('FS_BOLDIT', 9004); |
|
255
|
1 |
|
\define('FS_BOLDITALIC', 9004); |
|
256
|
|
|
|
|
257
|
|
|
//Definitions for internal font |
|
258
|
1 |
|
\define('FF_FONT0', 1); |
|
259
|
1 |
|
\define('FF_FONT1', 2); |
|
260
|
1 |
|
\define('FF_FONT2', 4); |
|
261
|
|
|
|
|
262
|
|
|
/* |
|
263
|
|
|
* Defines for font setup |
|
264
|
|
|
*/ |
|
265
|
|
|
// Actual name of the TTF file used together with FF_CHINESE aka FF_BIG5 |
|
266
|
|
|
// This is the TTF file being used when the font family is specified as |
|
267
|
|
|
// either FF_CHINESE or FF_BIG5 |
|
268
|
1 |
|
\define('CHINESE_TTF_FONT', 'bkai00mp.ttf'); |
|
269
|
|
|
|
|
270
|
|
|
// Special unicode greek language support |
|
271
|
1 |
|
\define('LANGUAGE_GREEK', false); |
|
272
|
|
|
|
|
273
|
|
|
// If you are setting this config to true the conversion of greek characters |
|
274
|
|
|
// will assume that the input text is windows 1251 |
|
275
|
1 |
|
\define('GREEK_FROM_WINDOWS', false); |
|
276
|
|
|
|
|
277
|
|
|
// Special unicode cyrillic language support |
|
278
|
1 |
|
\define('LANGUAGE_CYRILLIC', false); |
|
279
|
|
|
|
|
280
|
|
|
// If you are setting this config to true the conversion |
|
281
|
|
|
// will assume that the input text is windows 1251, if |
|
282
|
|
|
// false it will assume koi8-r |
|
283
|
1 |
|
\define('CYRILLIC_FROM_WINDOWS', false); |
|
284
|
|
|
|
|
285
|
|
|
// The following constant is used to auto-detect |
|
286
|
|
|
// whether cyrillic conversion is really necessary |
|
287
|
|
|
// if enabled. Just replace 'windows-1251' with a variable |
|
288
|
|
|
// containing the input character encoding string |
|
289
|
|
|
// of your application calling jpgraph. |
|
290
|
|
|
// A typical such string would be 'UTF-8' or 'utf-8'. |
|
291
|
|
|
// The comparison is case-insensitive. |
|
292
|
|
|
// If this charset is not a 'koi8-r' or 'windows-1251' |
|
293
|
|
|
// derivate then no conversion is done. |
|
294
|
|
|
// |
|
295
|
|
|
// This constant can be very important in multi-user |
|
296
|
|
|
// multi-language environments where a cyrillic conversion |
|
297
|
|
|
// could be needed for some cyrillic people |
|
298
|
|
|
// and resulting in just erraneous conversions |
|
299
|
|
|
// for not-cyrillic language based people. |
|
300
|
|
|
// |
|
301
|
|
|
// Example: In the free project management |
|
302
|
|
|
// software dotproject.net $locale_char_set is dynamically |
|
303
|
|
|
// set by the language environment the user has chosen. |
|
304
|
|
|
// |
|
305
|
|
|
// Usage: define('LANGUAGE_CHARSET', $locale_char_set); |
|
306
|
|
|
// |
|
307
|
|
|
// where $locale_char_set is a GLOBAL (string) variable |
|
308
|
|
|
// from the application including JpGraph. |
|
309
|
|
|
// |
|
310
|
1 |
|
\define('LANGUAGE_CHARSET', null); |
|
311
|
|
|
|
|
312
|
|
|
// Japanese TrueType font used with FF_MINCHO, FF_PMINCHO, FF_GOTHIC, FF_PGOTHIC |
|
313
|
|
|
// Standard fonts from Infomation-technology Promotion Agency (IPA) |
|
314
|
|
|
// See http://mix-mplus-ipa.sourceforge.jp/ |
|
315
|
1 |
|
\define('MINCHO_TTF_FONT', 'ipam.ttf'); |
|
316
|
1 |
|
\define('PMINCHO_TTF_FONT', 'ipamp.ttf'); |
|
317
|
1 |
|
\define('GOTHIC_TTF_FONT', 'ipag.ttf'); |
|
318
|
1 |
|
\define('PGOTHIC_TTF_FONT', 'ipagp.ttf'); |
|
319
|
|
|
|
|
320
|
|
|
// Assume that Japanese text have been entered in EUC-JP encoding. |
|
321
|
|
|
// If this define is true then conversion from EUC-JP to UTF8 is done |
|
322
|
|
|
// automatically in the library using the mbstring module in PHP. |
|
323
|
1 |
|
\define('ASSUME_EUCJP_ENCODING', false); |
|
324
|
|
|
|
|
325
|
|
|
// Default font family |
|
326
|
1 |
|
\define('FF_DEFAULT', FF_DV_SANSSERIF); |
|
327
|
|
|
|
|
328
|
|
|
// Line styles |
|
329
|
1 |
|
\define('LINESTYLE_SOLID', 1); |
|
330
|
1 |
|
\define('LINESTYLE_DOTTED', 2); |
|
331
|
1 |
|
\define('LINESTYLE_DASHED', 3); |
|
332
|
1 |
|
\define('LINESTYLE_LONGDASH', 4); |
|
333
|
|
|
|
|
334
|
|
|
// The DEFAULT_GFORMAT sets the default graphic encoding format, i.e. |
|
335
|
|
|
// PNG, JPG or GIF depending on what is installed on the target system |
|
336
|
|
|
// in that order. |
|
337
|
1 |
|
if (!\defined('DEFAULT_GFORMAT')) { |
|
338
|
|
|
\define('DEFAULT_GFORMAT', 'auto'); |
|
339
|
|
|
} |
|
340
|
|
|
|
|
341
|
|
|
// Styles for gradient color fill |
|
342
|
1 |
|
\define('GRAD_VER', 1); |
|
343
|
1 |
|
\define('GRAD_VERT', 1); |
|
344
|
1 |
|
\define('GRAD_HOR', 2); |
|
345
|
1 |
|
\define('GRAD_MIDHOR', 3); |
|
346
|
1 |
|
\define('GRAD_MIDVER', 4); |
|
347
|
1 |
|
\define('GRAD_CENTER', 5); |
|
348
|
1 |
|
\define('GRAD_WIDE_MIDVER', 6); |
|
349
|
1 |
|
\define('GRAD_WIDE_MIDHOR', 7); |
|
350
|
1 |
|
\define('GRAD_LEFT_REFLECTION', 8); |
|
351
|
1 |
|
\define('GRAD_RIGHT_REFLECTION', 9); |
|
352
|
1 |
|
\define('GRAD_RAISED_PANEL', 10); |
|
353
|
1 |
|
\define('GRAD_DIAGONAL', 11); |
|
354
|
1 |
|
\define('_DEFAULT_LPM_SIZE', 8); // Default Legend Plot Mark size |
|
355
|
|
|
|
|
356
|
|
|
// Version info |
|
357
|
1 |
|
\define('JPG_VERSION', '4.1.0'); |
|
358
|
|
|
|
|
359
|
|
|
// Minimum required PHP version |
|
360
|
1 |
|
\define('MIN_PHPVERSION', '7.2.0'); |
|
361
|
|
|
|
|
362
|
|
|
// Special file name to indicate that we only want to calc |
|
363
|
|
|
// the image map in the call to Graph::Stroke() used |
|
364
|
|
|
// internally from the GetHTMLCSIM() method. |
|
365
|
1 |
|
\define('_CSIM_SPECIALFILE', '_csim_special_'); |
|
366
|
|
|
|
|
367
|
|
|
// HTTP GET argument that is used with image map |
|
368
|
|
|
// to indicate to the script to just generate the image |
|
369
|
|
|
// and not the full CSIM HTML page. |
|
370
|
1 |
|
\define('_CSIM_DISPLAY', '_jpg_csimd'); |
|
371
|
|
|
|
|
372
|
|
|
// Special filename for Graph::Stroke(). If this filename is given |
|
373
|
|
|
// then the image will NOT be streamed to browser of file. Instead the |
|
374
|
|
|
// Stroke call will return the handler for the created GD image. |
|
375
|
1 |
|
\define('_IMG_HANDLER', '__handle'); |
|
376
|
|
|
|
|
377
|
|
|
// Special filename for Graph::Stroke(). If this filename is given |
|
378
|
|
|
// the image will be stroked to a file with a name based on the script name. |
|
379
|
1 |
|
\define('_IMG_AUTO', 'auto'); |
|
380
|
|
|
|
|
381
|
|
|
// Tick density |
|
382
|
1 |
|
\define('TICKD_DENSE', 1); |
|
383
|
1 |
|
\define('TICKD_NORMAL', 2); |
|
384
|
1 |
|
\define('TICKD_SPARSE', 3); |
|
385
|
1 |
|
\define('TICKD_VERYSPARSE', 4); |
|
386
|
|
|
|
|
387
|
|
|
// Side for ticks and labels. |
|
388
|
1 |
|
\define('SIDE_LEFT', -1); |
|
389
|
1 |
|
\define('SIDE_RIGHT', 1); |
|
390
|
1 |
|
\define('SIDE_DOWN', -1); |
|
391
|
1 |
|
\define('SIDE_BOTTOM', -1); |
|
392
|
1 |
|
\define('SIDE_UP', 1); |
|
393
|
1 |
|
\define('SIDE_TOP', 1); |
|
394
|
|
|
|
|
395
|
|
|
// Legend type stacked vertical or horizontal |
|
396
|
1 |
|
\define('LEGEND_VERT', 0); |
|
397
|
1 |
|
\define('LEGEND_HOR', 1); |
|
398
|
|
|
|
|
399
|
|
|
// Mark types for plot marks |
|
400
|
1 |
|
\define('MARK_SQUARE', 1); |
|
401
|
1 |
|
\define('MARK_UTRIANGLE', 2); |
|
402
|
1 |
|
\define('MARK_DTRIANGLE', 3); |
|
403
|
1 |
|
\define('MARK_DIAMOND', 4); |
|
404
|
1 |
|
\define('MARK_CIRCLE', 5); |
|
405
|
1 |
|
\define('MARK_FILLEDCIRCLE', 6); |
|
406
|
1 |
|
\define('MARK_CROSS', 7); |
|
407
|
1 |
|
\define('MARK_STAR', 8); |
|
408
|
1 |
|
\define('MARK_X', 9); |
|
409
|
1 |
|
\define('MARK_LEFTTRIANGLE', 10); |
|
410
|
1 |
|
\define('MARK_RIGHTTRIANGLE', 11); |
|
411
|
1 |
|
\define('MARK_FLASH', 12); |
|
412
|
1 |
|
\define('MARK_IMG', 13); |
|
413
|
1 |
|
\define('MARK_FLAG1', 14); |
|
414
|
1 |
|
\define('MARK_FLAG2', 15); |
|
415
|
1 |
|
\define('MARK_FLAG3', 16); |
|
416
|
1 |
|
\define('MARK_FLAG4', 17); |
|
417
|
|
|
|
|
418
|
|
|
// Builtin images |
|
419
|
1 |
|
\define('MARK_IMG_PUSHPIN', 50); |
|
420
|
1 |
|
\define('MARK_IMG_SPUSHPIN', 50); |
|
421
|
1 |
|
\define('MARK_IMG_LPUSHPIN', 51); |
|
422
|
1 |
|
\define('MARK_IMG_DIAMOND', 52); |
|
423
|
1 |
|
\define('MARK_IMG_SQUARE', 53); |
|
424
|
1 |
|
\define('MARK_IMG_STAR', 54); |
|
425
|
1 |
|
\define('MARK_IMG_BALL', 55); |
|
426
|
1 |
|
\define('MARK_IMG_SBALL', 55); |
|
427
|
1 |
|
\define('MARK_IMG_MBALL', 56); |
|
428
|
1 |
|
\define('MARK_IMG_LBALL', 57); |
|
429
|
1 |
|
\define('MARK_IMG_BEVEL', 58); |
|
430
|
|
|
|
|
431
|
|
|
// Inline defines |
|
432
|
1 |
|
\define('INLINE_YES', 1); |
|
433
|
1 |
|
\define('INLINE_NO', 0); |
|
434
|
|
|
|
|
435
|
|
|
// Format for background images |
|
436
|
1 |
|
\define('BGIMG_FILLPLOT', 1); |
|
437
|
1 |
|
\define('BGIMG_FILLFRAME', 2); |
|
438
|
1 |
|
\define('BGIMG_COPY', 3); |
|
439
|
1 |
|
\define('BGIMG_CENTER', 4); |
|
440
|
1 |
|
\define('BGIMG_FREE', 5); |
|
441
|
|
|
|
|
442
|
|
|
// Depth of objects |
|
443
|
1 |
|
\define('DEPTH_BACK', 0); |
|
444
|
1 |
|
\define('DEPTH_FRONT', 1); |
|
445
|
|
|
|
|
446
|
|
|
// Direction |
|
447
|
1 |
|
\define('VERTICAL', 1); |
|
448
|
1 |
|
\define('HORIZONTAL', 0); |
|
449
|
|
|
|
|
450
|
|
|
// Axis styles for scientific style axis |
|
451
|
1 |
|
\define('AXSTYLE_SIMPLE', 1); |
|
452
|
1 |
|
\define('AXSTYLE_BOXIN', 2); |
|
453
|
1 |
|
\define('AXSTYLE_BOXOUT', 3); |
|
454
|
1 |
|
\define('AXSTYLE_YBOXIN', 4); |
|
455
|
1 |
|
\define('AXSTYLE_YBOXOUT', 5); |
|
456
|
|
|
|
|
457
|
|
|
// Style for title backgrounds |
|
458
|
1 |
|
\define('TITLEBKG_STYLE1', 1); |
|
459
|
1 |
|
\define('TITLEBKG_STYLE2', 2); |
|
460
|
1 |
|
\define('TITLEBKG_STYLE3', 3); |
|
461
|
1 |
|
\define('TITLEBKG_FRAME_NONE', 0); |
|
462
|
1 |
|
\define('TITLEBKG_FRAME_FULL', 1); |
|
463
|
1 |
|
\define('TITLEBKG_FRAME_BOTTOM', 2); |
|
464
|
1 |
|
\define('TITLEBKG_FRAME_BEVEL', 3); |
|
465
|
1 |
|
\define('TITLEBKG_FILLSTYLE_HSTRIPED', 1); |
|
466
|
1 |
|
\define('TITLEBKG_FILLSTYLE_VSTRIPED', 2); |
|
467
|
1 |
|
\define('TITLEBKG_FILLSTYLE_SOLID', 3); |
|
468
|
|
|
|
|
469
|
|
|
// Styles for axis labels background |
|
470
|
1 |
|
\define('LABELBKG_NONE', 0); |
|
471
|
1 |
|
\define('LABELBKG_XAXIS', 1); |
|
472
|
1 |
|
\define('LABELBKG_YAXIS', 2); |
|
473
|
1 |
|
\define('LABELBKG_XAXISFULL', 3); |
|
474
|
1 |
|
\define('LABELBKG_YAXISFULL', 4); |
|
475
|
1 |
|
\define('LABELBKG_XYFULL', 5); |
|
476
|
1 |
|
\define('LABELBKG_XY', 6); |
|
477
|
|
|
|
|
478
|
|
|
// Style for background gradient fills |
|
479
|
1 |
|
\define('BGRAD_FRAME', 1); |
|
480
|
1 |
|
\define('BGRAD_MARGIN', 2); |
|
481
|
1 |
|
\define('BGRAD_PLOT', 3); |
|
482
|
|
|
|
|
483
|
|
|
// Width of tab titles |
|
484
|
1 |
|
\define('TABTITLE_WIDTHFIT', 0); |
|
485
|
1 |
|
\define('TABTITLE_WIDTHFULL', -1); |
|
486
|
|
|
|
|
487
|
|
|
// Defines for 3D skew directions |
|
488
|
1 |
|
\define('SKEW3D_UP', 0); |
|
489
|
1 |
|
\define('SKEW3D_DOWN', 1); |
|
490
|
1 |
|
\define('SKEW3D_LEFT', 2); |
|
491
|
1 |
|
\define('SKEW3D_RIGHT', 3); |
|
492
|
|
|
|
|
493
|
|
|
// For internal use only |
|
494
|
1 |
|
\define('_JPG_DEBUG', false); |
|
495
|
1 |
|
\define('_FORCE_IMGTOFILE', false); |
|
496
|
1 |
|
\define('_FORCE_IMGDIR', '/tmp/jpgimg/'); |
|
497
|
|
|
|
|
498
|
|
|
// |
|
499
|
|
|
// Automatic settings of path for cache and font directory |
|
500
|
|
|
// if they have not been previously specified |
|
501
|
|
|
// |
|
502
|
1 |
|
if (\mb_strstr(\PHP_OS, 'WIN')) { |
|
503
|
|
|
\define('SYSTEMROOT', \getenv('SystemRoot')); |
|
504
|
|
|
} |
|
505
|
|
|
|
|
506
|
1 |
|
if (USE_CACHE) { |
|
507
|
|
|
if (!\defined('CACHE_DIR')) { |
|
508
|
|
|
if (\mb_strstr(\PHP_OS, 'WIN')) { |
|
509
|
|
|
if (empty($_SERVER['TEMP'])) { |
|
510
|
|
|
$t = new ErrMsgText(); |
|
511
|
|
|
$msg = $t->Get(11, $file, $lineno); |
|
512
|
|
|
|
|
513
|
|
|
exit($msg); |
|
514
|
|
|
} |
|
515
|
|
|
\define('CACHE_DIR', $_SERVER['TEMP'] . '/'); |
|
516
|
|
|
} else { |
|
517
|
|
|
\define('CACHE_DIR', '/tmp/jpgraph_cache/'); |
|
518
|
|
|
} |
|
519
|
|
|
} |
|
520
|
1 |
|
} elseif (!\defined('CACHE_DIR')) { |
|
521
|
1 |
|
\define('CACHE_DIR', ''); |
|
522
|
|
|
} |
|
523
|
|
|
|
|
524
|
|
|
// |
|
525
|
|
|
// Setup path for western/latin TTF fonts |
|
526
|
|
|
// |
|
527
|
1 |
|
if (!\defined('TTF_DIR')) { |
|
528
|
1 |
|
if (\mb_strstr(\PHP_OS, 'WIN')) { |
|
529
|
|
|
if (empty(SYSTEMROOT)) { |
|
530
|
|
|
$t = new ErrMsgText(); |
|
531
|
|
|
$msg = $t->Get(12, $file, $lineno); |
|
532
|
|
|
|
|
533
|
|
|
exit($msg); |
|
534
|
|
|
} |
|
535
|
|
|
\define('TTF_DIR', SYSTEMROOT . '/fonts/'); |
|
536
|
|
|
} else { |
|
537
|
1 |
|
\define('TTF_DIR', '/usr/share/fonts/truetype/'); |
|
538
|
|
|
} |
|
539
|
|
|
} |
|
540
|
|
|
|
|
541
|
|
|
// |
|
542
|
|
|
// Setup path for MultiByte TTF fonts (japanese, chinese etc.) |
|
543
|
|
|
// |
|
544
|
1 |
|
if (!\defined('MBTTF_DIR')) { |
|
545
|
1 |
|
if (\mb_strstr(\PHP_OS, 'WIN')) { |
|
546
|
|
|
if (empty(SYSTEMROOT)) { |
|
547
|
|
|
$t = new ErrMsgText(); |
|
548
|
|
|
$msg = $t->Get(12, $file, $lineno); |
|
549
|
|
|
|
|
550
|
|
|
exit($msg); |
|
551
|
|
|
} |
|
552
|
|
|
\define('MBTTF_DIR', SYSTEMROOT . '/fonts/'); |
|
553
|
|
|
} else { |
|
554
|
1 |
|
\define('MBTTF_DIR', '/usr/share/fonts/truetype/'); |
|
555
|
|
|
} |
|
556
|
|
|
} |
|
557
|
|
|
|
|
558
|
|
|
// |
|
559
|
|
|
// Make sure PHP version is high enough |
|
560
|
|
|
// |
|
561
|
1 |
|
if (\version_compare(\PHP_VERSION, MIN_PHPVERSION) < 0) { |
|
562
|
|
|
Amenadiel\JpGraph\Util\JpGraphError::RaiseL(13, \PHP_VERSION, MIN_PHPVERSION); |
|
563
|
|
|
|
|
564
|
|
|
exit(); |
|
565
|
|
|
} |
|
566
|
|
|
|
|
567
|
|
|
// |
|
568
|
|
|
// Make GD sanity check |
|
569
|
|
|
// |
|
570
|
1 |
|
if (!\function_exists('imagetypes') || !\function_exists('imagecreatefromstring')) { |
|
571
|
|
|
Amenadiel\JpGraph\Util\JpGraphError::RaiseL(25001); |
|
572
|
|
|
//("This PHP installation is not configured with the GD library. Please recompile PHP with GD support to run JpGraph. (Neither function imagetypes() nor imagecreatefromstring() does exist)"); |
|
573
|
|
|
} |
|
574
|
|
|
|
|
575
|
1 |
|
if (INSTALL_PHP_ERR_HANDLER) { |
|
576
|
|
|
\set_error_handler('\Amenadiel\JpGraph\Util\Helper::phpErrorHandler'); |
|
577
|
|
|
} |
|
578
|
|
|
|
|
579
|
|
|
// |
|
580
|
|
|
// Check if there were any warnings, perhaps some wrong includes by the user. In this |
|
581
|
|
|
// case we raise it immediately since otherwise the image will not show and makes |
|
582
|
|
|
// debugging difficult. This is controlled by the user setting CATCH_PHPERRMSG |
|
583
|
|
|
// |
|
584
|
1 |
|
if (isset($GLOBALS['php_errormsg']) && CATCH_PHPERRMSG && !\preg_match('/|Deprecated|/i', $GLOBALS['php_errormsg'])) { |
|
585
|
|
|
Amenadiel\JpGraph\Util\JpGraphError::RaiseL(25004, $GLOBALS['php_errormsg']); |
|
586
|
|
|
} |
|
587
|
|
|
|
|
588
|
|
|
// Constants for types of static bands in plot area |
|
589
|
1 |
|
\define('BAND_RDIAG', 1); // Right diagonal lines |
|
590
|
1 |
|
\define('BAND_LDIAG', 2); // Left diagonal lines |
|
591
|
1 |
|
\define('BAND_SOLID', 3); // Solid one color |
|
592
|
1 |
|
\define('BAND_VLINE', 4); // Vertical lines |
|
593
|
1 |
|
\define('BAND_HLINE', 5); // Horizontal lines |
|
594
|
1 |
|
\define('BAND_3DPLANE', 6); // "3D" Plane |
|
595
|
1 |
|
\define('BAND_HVCROSS', 7); // Vertical/Hor crosses |
|
596
|
1 |
|
\define('BAND_DIAGCROSS', 8); // Diagonal crosses |
|
597
|
|
|
|
|
598
|
|
|
// Maximum size for Automatic Gantt chart |
|
599
|
1 |
|
\define('MAX_GANTTIMG_SIZE_W', 8000); |
|
600
|
1 |
|
\define('MAX_GANTTIMG_SIZE_H', 5000); |
|
601
|
|
|
|
|
602
|
|
|
// Scale Header types |
|
603
|
1 |
|
\define('GANTT_HDAY', 1); |
|
604
|
1 |
|
\define('GANTT_HWEEK', 2); |
|
605
|
1 |
|
\define('GANTT_HMONTH', 4); |
|
606
|
1 |
|
\define('GANTT_HYEAR', 8); |
|
607
|
1 |
|
\define('GANTT_HHOUR', 16); |
|
608
|
1 |
|
\define('GANTT_HMIN', 32); |
|
609
|
|
|
|
|
610
|
|
|
// Bar patterns |
|
611
|
1 |
|
\define('GANTT_RDIAG', BAND_RDIAG); // Right diagonal lines |
|
612
|
1 |
|
\define('GANTT_LDIAG', BAND_LDIAG); // Left diagonal lines |
|
613
|
1 |
|
\define('GANTT_SOLID', BAND_SOLID); // Solid one color |
|
614
|
1 |
|
\define('GANTT_VLINE', BAND_VLINE); // Vertical lines |
|
615
|
1 |
|
\define('GANTT_HLINE', BAND_HLINE); // Horizontal lines |
|
616
|
1 |
|
\define('GANTT_3DPLANE', BAND_3DPLANE); // "3D" Plane |
|
617
|
1 |
|
\define('GANTT_HVCROSS', BAND_HVCROSS); // Vertical/Hor crosses |
|
618
|
1 |
|
\define('GANTT_DIAGCROSS', BAND_DIAGCROSS); // Diagonal crosses |
|
619
|
|
|
|
|
620
|
|
|
// Conversion constant |
|
621
|
1 |
|
\define('HOURADJ_1', 0 + 30); |
|
622
|
1 |
|
\define('HOURADJ_2', 1 + 30); |
|
623
|
1 |
|
\define('HOURADJ_3', 2 + 30); |
|
624
|
1 |
|
\define('HOURADJ_4', 3 + 30); |
|
625
|
1 |
|
\define('HOURADJ_6', 4 + 30); |
|
626
|
1 |
|
\define('HOURADJ_12', 5 + 30); |
|
627
|
|
|
|
|
628
|
1 |
|
\define('MINADJ_1', 0 + 20); |
|
629
|
1 |
|
\define('MINADJ_5', 1 + 20); |
|
630
|
1 |
|
\define('MINADJ_10', 2 + 20); |
|
631
|
1 |
|
\define('MINADJ_15', 3 + 20); |
|
632
|
1 |
|
\define('MINADJ_30', 4 + 20); |
|
633
|
|
|
|
|
634
|
1 |
|
\define('SECADJ_1', 0); |
|
635
|
1 |
|
\define('SECADJ_5', 1); |
|
636
|
1 |
|
\define('SECADJ_10', 2); |
|
637
|
1 |
|
\define('SECADJ_15', 3); |
|
638
|
1 |
|
\define('SECADJ_30', 4); |
|
639
|
|
|
|
|
640
|
1 |
|
\define('YEARADJ_1', 0 + 30); |
|
641
|
1 |
|
\define('YEARADJ_2', 1 + 30); |
|
642
|
1 |
|
\define('YEARADJ_5', 2 + 30); |
|
643
|
|
|
|
|
644
|
1 |
|
\define('MONTHADJ_1', 0 + 20); |
|
645
|
1 |
|
\define('MONTHADJ_6', 1 + 20); |
|
646
|
|
|
|
|
647
|
1 |
|
\define('DAYADJ_1', 0); |
|
648
|
1 |
|
\define('DAYADJ_WEEK', 1); |
|
649
|
1 |
|
\define('DAYADJ_7', 1); |
|
650
|
|
|
|
|
651
|
1 |
|
\define('SECPERYEAR', 31536000); |
|
652
|
1 |
|
\define('SECPERDAY', 86400); |
|
653
|
1 |
|
\define('SECPERHOUR', 3600); |
|
654
|
1 |
|
\define('SECPERMIN', 60); |
|
655
|
|
|
|
|
656
|
|
|
// Locales. ONLY KEPT FOR BACKWARDS COMPATIBILITY |
|
657
|
|
|
// You should use the proper locale strings directly |
|
658
|
|
|
// from now on. |
|
659
|
1 |
|
\define('LOCALE_EN', 'en_UK'); |
|
660
|
1 |
|
\define('LOCALE_SV', 'sv_SE'); |
|
661
|
|
|
|
|
662
|
|
|
// Layout of bars |
|
663
|
1 |
|
\define('GANTT_EVEN', 1); |
|
664
|
1 |
|
\define('GANTT_FROMTOP', 2); |
|
665
|
|
|
|
|
666
|
|
|
// Style for minute header |
|
667
|
1 |
|
\define('MINUTESTYLE_MM', 0); // 15 |
|
668
|
1 |
|
\define('MINUTESTYLE_CUSTOM', 2); // Custom format |
|
669
|
|
|
|
|
670
|
|
|
// Style for hour header |
|
671
|
1 |
|
\define('HOURSTYLE_HM24', 0); // 13:10 |
|
672
|
1 |
|
\define('HOURSTYLE_HMAMPM', 1); // 1:10pm |
|
673
|
1 |
|
\define('HOURSTYLE_H24', 2); // 13 |
|
674
|
1 |
|
\define('HOURSTYLE_HAMPM', 3); // 1pm |
|
675
|
1 |
|
\define('HOURSTYLE_CUSTOM', 4); // User defined |
|
676
|
|
|
|
|
677
|
|
|
// Style for day header |
|
678
|
1 |
|
\define('DAYSTYLE_ONELETTER', 0); // "M" |
|
679
|
1 |
|
\define('DAYSTYLE_LONG', 1); // "Monday" |
|
680
|
1 |
|
\define('DAYSTYLE_LONGDAYDATE1', 2); // "Monday 23 Jun" |
|
681
|
1 |
|
\define('DAYSTYLE_LONGDAYDATE2', 3); // "Monday 23 Jun 2003" |
|
682
|
1 |
|
\define('DAYSTYLE_SHORT', 4); // "Mon" |
|
683
|
1 |
|
\define('DAYSTYLE_SHORTDAYDATE1', 5); // "Mon 23/6" |
|
684
|
1 |
|
\define('DAYSTYLE_SHORTDAYDATE2', 6); // "Mon 23 Jun" |
|
685
|
1 |
|
\define('DAYSTYLE_SHORTDAYDATE3', 7); // "Mon 23" |
|
686
|
1 |
|
\define('DAYSTYLE_SHORTDATE1', 8); // "23/6" |
|
687
|
1 |
|
\define('DAYSTYLE_SHORTDATE2', 9); // "23 Jun" |
|
688
|
1 |
|
\define('DAYSTYLE_SHORTDATE3', 10); // "Mon 23" |
|
689
|
1 |
|
\define('DAYSTYLE_SHORTDATE4', 11); // "23" |
|
690
|
1 |
|
\define('DAYSTYLE_CUSTOM', 12); // "M" |
|
691
|
|
|
|
|
692
|
|
|
// Styles for week header |
|
693
|
1 |
|
\define('WEEKSTYLE_WNBR', 0); |
|
694
|
1 |
|
\define('WEEKSTYLE_FIRSTDAY', 1); |
|
695
|
1 |
|
\define('WEEKSTYLE_FIRSTDAY2', 2); |
|
696
|
1 |
|
\define('WEEKSTYLE_FIRSTDAYWNBR', 3); |
|
697
|
1 |
|
\define('WEEKSTYLE_FIRSTDAY2WNBR', 4); |
|
698
|
|
|
|
|
699
|
|
|
// Styles for month header |
|
700
|
1 |
|
\define('MONTHSTYLE_SHORTNAME', 0); |
|
701
|
1 |
|
\define('MONTHSTYLE_LONGNAME', 1); |
|
702
|
1 |
|
\define('MONTHSTYLE_LONGNAMEYEAR2', 2); |
|
703
|
1 |
|
\define('MONTHSTYLE_SHORTNAMEYEAR2', 3); |
|
704
|
1 |
|
\define('MONTHSTYLE_LONGNAMEYEAR4', 4); |
|
705
|
1 |
|
\define('MONTHSTYLE_SHORTNAMEYEAR4', 5); |
|
706
|
1 |
|
\define('MONTHSTYLE_FIRSTLETTER', 6); |
|
707
|
|
|
|
|
708
|
|
|
// Types of constrain links |
|
709
|
1 |
|
\define('CONSTRAIN_STARTSTART', 0); |
|
710
|
1 |
|
\define('CONSTRAIN_STARTEND', 1); |
|
711
|
1 |
|
\define('CONSTRAIN_ENDSTART', 2); |
|
712
|
1 |
|
\define('CONSTRAIN_ENDEND', 3); |
|
713
|
|
|
|
|
714
|
|
|
// Arrow direction for constrain links |
|
715
|
1 |
|
\define('ARROW_DOWN', 0); |
|
716
|
1 |
|
\define('ARROW_UP', 1); |
|
717
|
1 |
|
\define('ARROW_LEFT', 2); |
|
718
|
1 |
|
\define('ARROW_RIGHT', 3); |
|
719
|
|
|
|
|
720
|
|
|
// Arrow type for constrain type |
|
721
|
1 |
|
\define('ARROWT_SOLID', 0); |
|
722
|
1 |
|
\define('ARROWT_OPEN', 1); |
|
723
|
|
|
|
|
724
|
|
|
// Arrow size for constrain lines |
|
725
|
1 |
|
\define('ARROW_S1', 0); |
|
726
|
1 |
|
\define('ARROW_S2', 1); |
|
727
|
1 |
|
\define('ARROW_S3', 2); |
|
728
|
1 |
|
\define('ARROW_S4', 3); |
|
729
|
1 |
|
\define('ARROW_S5', 4); |
|
730
|
|
|
|
|
731
|
|
|
// Activity types for use with utility method CreateSimple() |
|
732
|
1 |
|
\define('ACTYPE_NORMAL', 0); |
|
733
|
1 |
|
\define('ACTYPE_GROUP', 1); |
|
734
|
1 |
|
\define('ACTYPE_MILESTONE', 2); |
|
735
|
|
|
|
|
736
|
1 |
|
\define('ACTINFO_3D', 1); |
|
737
|
1 |
|
\define('ACTINFO_2D', 0); |
|
738
|
|
|
|
|
739
|
1 |
|
\define('GICON_WARNINGRED', 0); |
|
740
|
1 |
|
\define('GICON_TEXT', 1); |
|
741
|
1 |
|
\define('GICON_ENDCONS', 2); |
|
742
|
1 |
|
\define('GICON_MAIL', 3); |
|
743
|
1 |
|
\define('GICON_STARTCONS', 4); |
|
744
|
1 |
|
\define('GICON_CALC', 5); |
|
745
|
1 |
|
\define('GICON_MAGNIFIER', 6); |
|
746
|
1 |
|
\define('GICON_LOCK', 7); |
|
747
|
1 |
|
\define('GICON_STOP', 8); |
|
748
|
1 |
|
\define('GICON_WARNINGYELLOW', 9); |
|
749
|
1 |
|
\define('GICON_FOLDEROPEN', 10); |
|
750
|
1 |
|
\define('GICON_FOLDER', 11); |
|
751
|
1 |
|
\define('GICON_TEXTIMPORTANT', 12); |
|
752
|
|
|
|
|
753
|
|
|
|
|
754
|
1 |
|
if (!\function_exists('is_countable')) { |
|
755
|
|
|
function is_countable($c) |
|
756
|
|
|
{ |
|
757
|
|
|
return \is_array($c) || $c instanceof Countable; |
|
758
|
|
|
} |
|
759
|
|
|
} |
|
760
|
|
|
|
|
761
|
|
|
/** |
|
762
|
|
|
* Returns the item count of the variable, or zero if it's non countable. |
|
763
|
|
|
* |
|
764
|
|
|
* @param mixed $var The variable whose items we want to count |
|
765
|
|
|
*/ |
|
766
|
|
|
function safe_count($var) |
|
767
|
|
|
{ |
|
768
|
21 |
|
if (\is_countable($var)) { |
|
769
|
21 |
|
return \count($var); |
|
770
|
|
|
} |
|
771
|
|
|
|
|
772
|
|
|
return 0; |
|
773
|
|
|
} |
|
774
|
|
|
|