1
|
|
|
<?php |
|
|
|
|
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* JPGraph v4.1.0-beta.01 |
5
|
|
|
*/ |
6
|
|
|
|
7
|
|
|
namespace Amenadiel\JpGraph\Util; |
8
|
|
|
|
9
|
|
|
use Exception; |
10
|
|
|
|
11
|
|
|
defined('DEFAULT_ERR_LOCALE') || define('DEFAULT_ERR_LOCALE', 'en'); |
12
|
|
|
|
13
|
|
|
require_once __DIR__ . '/../config.inc.php'; |
14
|
|
|
|
15
|
|
|
if (!function_exists('\is_countable')) { |
16
|
|
|
function is_countable($c) |
17
|
|
|
{ |
18
|
|
|
return is_array($c) || $c instanceof \Countable; |
19
|
|
|
} |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
/* |
23
|
|
|
* NOTE THAT CACHE FUNCTIONALITY IS TURNED OFF BY DEFAULT ENABLE BY SETTING USE_CACHE TO TRUE) |
24
|
|
|
* Should the cache be used at all? By setting this to false no |
25
|
|
|
* files will be generated in the cache directory. |
26
|
|
|
* The difference from READ_CACHE being that setting READ_CACHE to |
27
|
|
|
* false will still create the image in the cache directory |
28
|
|
|
* just not use it. By setting USE_CACHE=false no files will even |
29
|
|
|
* be generated in the cache directory. |
30
|
|
|
*/ |
31
|
|
|
defined('USE_CACHE') || define('USE_CACHE', getenv('JPGRAPH_USE_CACHE') || false); |
32
|
|
|
|
33
|
|
|
/* |
34
|
|
|
* Directories for cache and font directory. |
35
|
|
|
* Define these constants explicitly or read them from environment vars |
36
|
|
|
* |
37
|
|
|
* CACHE_DIR: |
38
|
|
|
* The full absolute name of the directory to be used to store the |
39
|
|
|
* cached image files. This directory will not be used if the USE_CACHE |
40
|
|
|
* define (further down) is false. If you enable the cache please note that |
41
|
|
|
* this directory MUST be readable and writable for the process running PHP. |
42
|
|
|
* Must end with '/' |
43
|
|
|
* |
44
|
|
|
* TTF_DIR: |
45
|
|
|
* Directory where TTF fonts can be found. Must end with '/' |
46
|
|
|
* |
47
|
|
|
* The default values used if these defines are left commented out are: |
48
|
|
|
* |
49
|
|
|
* UNIX: |
50
|
|
|
* CACHE_DIR /tmp/jpgraph_cache/ |
51
|
|
|
* TTF_DIR /usr/share/fonts/truetype/ |
52
|
|
|
* MBTTF_DIR /usr/share/fonts/truetype/ |
53
|
|
|
* |
54
|
|
|
* WINDOWS: |
55
|
|
|
* CACHE_DIR $SERVER_TEMP/jpgraph_cache/ |
56
|
|
|
* TTF_DIR $SERVER_SYSTEMROOT/fonts/ |
57
|
|
|
* MBTTF_DIR $SERVER_SYSTEMROOT/fonts/ |
58
|
|
|
* |
59
|
|
|
*/ |
60
|
|
|
if (strstr(PHP_OS, 'WIN') && getenv('SystemRoot')) { |
61
|
|
|
define('SYSTEMROOT', getenv('SystemRoot')); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
// Define these constants explicitly |
65
|
|
|
// define('CACHE_DIR','/tmp/jpgraph_cache/'); |
66
|
|
|
// define('TTF_DIR','/usr/share/fonts/TrueType/'); |
67
|
|
|
// define('MBTTF_DIR','/usr/share/fonts/TrueType/'); |
68
|
|
|
// |
69
|
|
|
// Or read them from environment variables |
70
|
|
|
if (getenv('JPGRAPH_CACHE_DIR')) { |
71
|
|
|
define('CACHE_DIR', getenv('JPGRAPH_CACHE_DIR')); |
72
|
|
|
} |
73
|
|
|
if (getenv('JPGRAPH_TTF_DIR')) { |
74
|
|
|
define('TTF_DIR', getenv('JPGRAPH_TTF_DIR')); |
75
|
|
|
} |
76
|
|
|
if (getenv('JPGRAPH_MBTTF_DIR')) { |
77
|
|
|
define('MBTTF_DIR', getenv('JPGRAPH_MBTTF_DIR')); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/* |
81
|
|
|
* Cache directory specification for use with CSIM graphs that are |
82
|
|
|
* // using the cache. |
83
|
|
|
* // The directory must be the filesysystem name as seen by PHP |
84
|
|
|
* // and the 'http' version must be the same directory but as |
85
|
|
|
* // seen by the HTTP server relative to the 'htdocs' ddirectory. |
86
|
|
|
* // If a relative path is specified it is taken to be relative from where |
87
|
|
|
* // the image script is executed. |
88
|
|
|
* // Note: The default setting is to create a subdirectory in the |
89
|
|
|
* // directory from where the image script is executed and store all files |
90
|
|
|
* // there. As ususal this directory must be writeable by the PHP process. |
91
|
|
|
*/ |
92
|
|
|
define('CSIMCACHE_DIR', getenv('JPGRAPH_CSIMCACHE_DIR') || 'csimcache/'); |
93
|
|
|
define('CSIMCACHE_HTTP_DIR', getenv('JPGRAPH_CSIMCACHE_HTTP_DIR') || 'csimcache/'); |
94
|
|
|
|
95
|
|
|
// Should we try to find an image in the cache before generating it? |
96
|
|
|
// Set this define to false to bypass the reading of the cache and always |
97
|
|
|
// regenerate the image. Note that even if reading the cache is |
98
|
|
|
// disabled the cached will still be updated with the newly generated |
99
|
|
|
// image. Set also 'USE_CACHE' below. |
100
|
|
|
defined('READ_CACHE') || define('READ_CACHE', true); |
101
|
|
|
|
102
|
|
|
/* |
103
|
|
|
* The following constants should rarely have to be changed ! |
104
|
|
|
*/ |
105
|
|
|
// What group should the cached file belong to |
106
|
|
|
// (Set to '' will give the default group for the 'PHP-user') |
107
|
|
|
// Please note that the Apache user must be a member of the |
108
|
|
|
// specified group since otherwise it is impossible for Apache |
109
|
|
|
// to set the specified group. |
110
|
|
|
defined('CACHE_FILE_GROUP') || define('CACHE_FILE_GROUP', getenv('JPGRAPH_CACHE_FILE_GROUP') || 'www'); |
111
|
|
|
|
112
|
|
|
// What permissions should the cached file have |
113
|
|
|
// (Set to '' will give the default persmissions for the 'PHP-user') |
114
|
|
|
defined('CACHE_FILE_MOD') || define('CACHE_FILE_MOD', getenv('JPGRAPH_CACHE_FILE_MOD') || 0664); |
115
|
|
|
defined('DEFAULT_THEME_CLASS') || define('DEFAULT_THEME_CLASS', 'UniversalTheme'); |
116
|
|
|
|
117
|
|
|
/* |
118
|
|
|
* NOTE THAT CACHE FUNCTIONALITY IS TURNED OFF BY DEFAULT ENABLE BY SETTING USE_CACHE TO TRUE) |
119
|
|
|
* Should the cache be used at all? By setting this to false no |
120
|
|
|
* files will be generated in the cache directory. |
121
|
|
|
* The difference from READ_CACHE being that setting READ_CACHE to |
122
|
|
|
* false will still create the image in the cache directory |
123
|
|
|
* just not use it. By setting USE_CACHE=false no files will even |
124
|
|
|
* be generated in the cache directory. |
125
|
|
|
*/ |
126
|
|
|
defined('USE_CACHE') || define('USE_CACHE', getenv('JPGRAPH_USE_CACHE') || false); |
127
|
|
|
/** |
128
|
|
|
* @class Configs |
129
|
|
|
* |
130
|
|
|
* Basic constants getter and setter. |
131
|
|
|
* self::f(he user beforehand, |
132
|
|
|
* self::t(efaults defined here. |
133
|
|
|
*/ |
134
|
|
|
class Configs |
135
|
|
|
{ |
136
|
|
|
const GICON_WARNINGRED = 0; |
137
|
|
|
const GICON_TEXT = 1; |
138
|
|
|
const GICON_ENDCONS = 2; |
139
|
|
|
const GICON_MAIL = 3; |
140
|
|
|
const GICON_STARTCONS = 4; |
141
|
|
|
const GICON_CALC = 5; |
142
|
|
|
const GICON_MAGNIFIER = 6; |
143
|
|
|
const GICON_LOCK = 7; |
144
|
|
|
const GICON_STOP = 8; |
145
|
|
|
const GICON_WARNINGYELLOW = 9; |
146
|
|
|
const GICON_FOLDEROPEN = 10; |
147
|
|
|
const GICON_FOLDER = 11; |
148
|
|
|
const GICON_TEXTIMPORTANT = 12; |
149
|
|
|
const LBLALIGN_CENTER = 1; |
150
|
|
|
const LBLALIGN_TOP = 2; |
151
|
|
|
const FF_DEFAULT = 47; |
152
|
|
|
// Configs for types of static bands in plot area |
153
|
|
|
const BAND_RDIAG = 1; // Right diagonal lines |
154
|
|
|
const BAND_LDIAG = 2; // Left diagonal lines |
155
|
|
|
const BAND_SOLID = 3; // Solid one color |
156
|
|
|
const BAND_VLINE = 4; // Vertical lines |
157
|
|
|
const BAND_HLINE = 5; // Horizontal lines |
158
|
|
|
const BAND_3DPLANE = 6; // "3D" Plane |
159
|
|
|
const BAND_HVCROSS = 7; // Vertical/Hor crosses |
160
|
|
|
const BAND_DIAGCROSS = 8; // Diagonal crosses |
161
|
|
|
|
162
|
|
|
//const CACHE_DIR=CACHE_DIR; |
163
|
|
|
//const TTF_DIR=TTF_DIR; |
164
|
|
|
//const MBTTF_DIR=MBTTF_DIR; |
165
|
|
|
const CSIMCACHE_DIR = CSIMCACHE_DIR; |
166
|
|
|
const CSIMCACHE_HTTP_DIR = CSIMCACHE_HTTP_DIR; |
167
|
|
|
const READ_CACHE = READ_CACHE; |
168
|
|
|
const CACHE_FILE_GROUP = CACHE_FILE_GROUP; |
169
|
|
|
const CACHE_FILE_MOD = CACHE_FILE_MOD; |
170
|
|
|
//const DEFAULT_THEME_CLASS=DEFAULT_THEME_CLASS; |
171
|
|
|
// Bar patterns |
172
|
|
|
const GANTT_RDIAG = self::BAND_RDIAG; // Right diagonal lines |
173
|
|
|
const GANTT_LDIAG = self::BAND_LDIAG; // Left diagonal lines |
174
|
|
|
const GANTT_SOLID = self::BAND_SOLID; // Solid one color |
175
|
|
|
const GANTT_VLINE = self::BAND_VLINE; // Vertical lines |
176
|
|
|
const GANTT_HLINE = self::BAND_HLINE; // Horizontal lines |
177
|
|
|
const GANTT_3DPLANE = self::BAND_3DPLANE; // "3D" Plane |
178
|
|
|
const GANTT_HVCROSS = self::BAND_HVCROSS; // Vertical/Hor crosses |
179
|
|
|
const GANTT_DIAGCROSS = self::BAND_DIAGCROSS; // Diagonal crosses |
180
|
|
|
// Scale Header types |
181
|
|
|
const GANTT_HDAY = 1; |
182
|
|
|
const GANTT_HWEEK = 2; |
183
|
|
|
const GANTT_HMONTH = 4; |
184
|
|
|
const GANTT_HYEAR = 8; |
185
|
|
|
const GANTT_HHOUR = 16; |
186
|
|
|
const GANTT_HMIN = 32; |
187
|
|
|
|
188
|
|
|
// Conversion constant |
189
|
|
|
const HOURADJ_1 = 0 + 30; |
190
|
|
|
const HOURADJ_2 = 1 + 30; |
191
|
|
|
const HOURADJ_3 = 2 + 30; |
192
|
|
|
const HOURADJ_4 = 3 + 30; |
193
|
|
|
const HOURADJ_6 = 4 + 30; |
194
|
|
|
const HOURADJ_12 = 5 + 30; |
195
|
|
|
const MINADJ_1 = 0 + 20; |
196
|
|
|
const MINADJ_5 = 1 + 20; |
197
|
|
|
const MINADJ_10 = 2 + 20; |
198
|
|
|
const MINADJ_15 = 3 + 20; |
199
|
|
|
const MINADJ_30 = 4 + 20; |
200
|
|
|
const SECADJ_1 = 0; |
201
|
|
|
const SECADJ_5 = 1; |
202
|
|
|
const SECADJ_10 = 2; |
203
|
|
|
const SECADJ_15 = 3; |
204
|
|
|
const SECADJ_30 = 4; |
205
|
|
|
const YEARADJ_1 = 0 + 30; |
206
|
|
|
const YEARADJ_2 = 1 + 30; |
207
|
|
|
const YEARADJ_5 = 2 + 30; |
208
|
|
|
const MONTHADJ_1 = 0 + 20; |
209
|
|
|
const MONTHADJ_6 = 1 + 20; |
210
|
|
|
const DAYADJ_1 = 0; |
211
|
|
|
const DAYADJ_WEEK = 1; |
212
|
|
|
const DAYADJ_7 = 1; |
213
|
|
|
const SECPERYEAR = 31536000; |
214
|
|
|
const SECPERDAY = 86400; |
215
|
|
|
const SECPERHOUR = 3600; |
216
|
|
|
const SECPERMIN = 60; |
217
|
|
|
// Layout of bars |
218
|
|
|
const GANTT_EVEN = 1; |
219
|
|
|
const GANTT_FROMTOP = 2; |
220
|
|
|
// Style for minute header |
221
|
|
|
const MINUTESTYLE_MM = 0; // 15 |
222
|
|
|
const MINUTESTYLE_CUSTOM = 2; // Custom format |
223
|
|
|
// Style for hour header |
224
|
|
|
const HOURSTYLE_HM24 = 0; // 13:10 |
225
|
|
|
const HOURSTYLE_HMAMPM = 1; // 1:10pm |
226
|
|
|
const HOURSTYLE_H24 = 2; // 13 |
227
|
|
|
const HOURSTYLE_HAMPM = 3; // 1pm |
228
|
|
|
const HOURSTYLE_CUSTOM = 4; // User defined |
229
|
|
|
// Style for day header |
230
|
|
|
const DAYSTYLE_ONELETTER = 0; // "M" |
231
|
|
|
const DAYSTYLE_LONG = 1; // "Monday" |
232
|
|
|
const DAYSTYLE_LONGDAYDATE1 = 2; // "Monday 23 Jun" |
233
|
|
|
const DAYSTYLE_LONGDAYDATE2 = 3; // "Monday 23 Jun 2003" |
234
|
|
|
const DAYSTYLE_SHORT = 4; // "Mon" |
235
|
|
|
const DAYSTYLE_SHORTDAYDATE1 = 5; // "Mon 23/6" |
236
|
|
|
const DAYSTYLE_SHORTDAYDATE2 = 6; // "Mon 23 Jun" |
237
|
|
|
const DAYSTYLE_SHORTDAYDATE3 = 7; // "Mon 23" |
238
|
|
|
const DAYSTYLE_SHORTDATE1 = 8; // "23/6" |
239
|
|
|
const DAYSTYLE_SHORTDATE2 = 9; // "23 Jun" |
240
|
|
|
const DAYSTYLE_SHORTDATE3 = 10; // "Mon 23" |
241
|
|
|
const DAYSTYLE_SHORTDATE4 = 11; // "23" |
242
|
|
|
const DAYSTYLE_CUSTOM = 12; // "M" |
243
|
|
|
// Styles for week header |
244
|
|
|
const WEEKSTYLE_WNBR = 0; |
245
|
|
|
const WEEKSTYLE_FIRSTDAY = 1; |
246
|
|
|
const WEEKSTYLE_FIRSTDAY2 = 2; |
247
|
|
|
const WEEKSTYLE_FIRSTDAYWNBR = 3; |
248
|
|
|
const WEEKSTYLE_FIRSTDAY2WNBR = 4; |
249
|
|
|
// Styles for month header |
250
|
|
|
const MONTHSTYLE_SHORTNAME = 0; |
251
|
|
|
const MONTHSTYLE_LONGNAME = 1; |
252
|
|
|
const MONTHSTYLE_LONGNAMEYEAR2 = 2; |
253
|
|
|
const MONTHSTYLE_SHORTNAMEYEAR2 = 3; |
254
|
|
|
const MONTHSTYLE_LONGNAMEYEAR4 = 4; |
255
|
|
|
const MONTHSTYLE_SHORTNAMEYEAR4 = 5; |
256
|
|
|
const MONTHSTYLE_FIRSTLETTER = 6; |
257
|
|
|
// Types of constrain links |
258
|
|
|
const CONSTRAIN_STARTSTART = 0; |
259
|
|
|
const CONSTRAIN_STARTEND = 1; |
260
|
|
|
const CONSTRAIN_ENDSTART = 2; |
261
|
|
|
const CONSTRAIN_ENDEND = 3; |
262
|
|
|
// Arrow direction for constrain links |
263
|
|
|
const ARROW_DOWN = 0; |
264
|
|
|
const ARROW_UP = 1; |
265
|
|
|
const ARROW_LEFT = 2; |
266
|
|
|
const ARROW_RIGHT = 3; |
267
|
|
|
// Arrow type for constrain type |
268
|
|
|
const ARROWT_SOLID = 0; |
269
|
|
|
const ARROWT_OPEN = 1; |
270
|
|
|
// Arrow size for constrain lines |
271
|
|
|
const ARROW_S1 = 0; |
272
|
|
|
const ARROW_S2 = 1; |
273
|
|
|
const ARROW_S3 = 2; |
274
|
|
|
const ARROW_S4 = 3; |
275
|
|
|
const ARROW_S5 = 4; |
276
|
|
|
// Activity types for use with utility method CreateSimple() |
277
|
|
|
const ACTYPE_NORMAL = 0; |
278
|
|
|
const ACTYPE_GROUP = 1; |
279
|
|
|
const ACTYPE_MILESTONE = 2; |
280
|
|
|
const ACTINFO_3D = 1; |
281
|
|
|
const ACTINFO_2D = 0; |
282
|
|
|
|
283
|
|
|
const _CSIM_DISPLAY = '_jpg_csimd'; |
284
|
|
|
const _CSIM_SPECIALFILE = '_csim_special_'; |
285
|
|
|
const _DEFAULT_LPM_SIZE = 8; // Default Legend Plot Mark size; |
286
|
|
|
const _FORCE_IMGDIR = '/tmp/jpgimg/'; |
287
|
|
|
const _FORCE_IMGTOFILE = false; |
288
|
|
|
const _IMG_AUTO = 'auto'; |
289
|
|
|
const _IMG_HANDLER = '__handle'; |
290
|
|
|
const _JPG_DEBUG = false; |
291
|
|
|
|
292
|
|
|
/*const ACTINFO_2D = 0; |
293
|
|
|
const ACTINFO_3D = 1; |
294
|
|
|
const ACTYPE_GROUP = 1; |
295
|
|
|
const ACTYPE_MILESTONE = 2; |
296
|
|
|
const ACTYPE_NORMAL = 0; |
297
|
|
|
const ARROW_DOWN = 0; |
298
|
|
|
const ARROW_LEFT = 2; |
299
|
|
|
const ARROW_RIGHT = 3; |
300
|
|
|
const ARROW_S1 = 0; |
301
|
|
|
const ARROW_S2 = 1; |
302
|
|
|
const ARROW_S3 = 2; |
303
|
|
|
const ARROW_S4 = 3; |
304
|
|
|
const ARROW_S5 = 4; |
305
|
|
|
const ARROW_UP = 1; |
306
|
|
|
const ARROWT_OPEN = 1; |
307
|
|
|
const ARROWT_SOLID = 0;*/ |
308
|
|
|
|
309
|
|
|
const AXSTYLE_BOXIN = 2; |
310
|
|
|
const AXSTYLE_BOXOUT = 3; |
311
|
|
|
const AXSTYLE_SIMPLE = 1; |
312
|
|
|
const AXSTYLE_YBOXIN = 4; |
313
|
|
|
const AXSTYLE_YBOXOUT = 5; |
314
|
|
|
const BGIMG_CENTER = 4; |
315
|
|
|
const BGIMG_COPY = 3; |
316
|
|
|
const BGIMG_FILLFRAME = 2; |
317
|
|
|
const BGIMG_FILLPLOT = 1; |
318
|
|
|
const BGIMG_FREE = 5; |
319
|
|
|
const BGRAD_FRAME = 1; |
320
|
|
|
const BGRAD_MARGIN = 2; |
321
|
|
|
const BGRAD_PLOT = 3; |
322
|
|
|
const CACHE_DIR = '/tmp/jpgraph_cache/'; |
323
|
|
|
const CATCH_PHPERRMSG = true; |
324
|
|
|
const CHINESE_TTF_FONT = 'bkai00mp.ttf'; |
325
|
|
|
/* |
326
|
|
|
const CONSTRAIN_ENDEND = 3; |
327
|
|
|
const CONSTRAIN_ENDSTART = 2; |
328
|
|
|
const CONSTRAIN_STARTEND = 1; |
329
|
|
|
const CONSTRAIN_STARTSTART = 0; |
330
|
|
|
*/ |
331
|
|
|
|
332
|
|
|
const CYRILLIC_FROM_WINDOWS = false; |
333
|
|
|
/* |
334
|
|
|
const DAYADJ_1 = 0; |
335
|
|
|
const DAYADJ_7 = 1; |
336
|
|
|
const DAYADJ_WEEK = 1; |
337
|
|
|
const DAYSTYLE_CUSTOM = 12; |
338
|
|
|
const DAYSTYLE_LONG = 1; |
339
|
|
|
const DAYSTYLE_LONGDAYDATE1 = 2; |
340
|
|
|
const DAYSTYLE_LONGDAYDATE2 = 3; |
341
|
|
|
const DAYSTYLE_ONELETTER = 0; |
342
|
|
|
const DAYSTYLE_SHORT = 4; |
343
|
|
|
const DAYSTYLE_SHORTDATE1 = 8; |
344
|
|
|
const DAYSTYLE_SHORTDATE2 = 9; |
345
|
|
|
const DAYSTYLE_SHORTDATE3 = 10; |
346
|
|
|
const DAYSTYLE_SHORTDATE4 = 11; |
347
|
|
|
const DAYSTYLE_SHORTDAYDATE1 = 5; |
348
|
|
|
const DAYSTYLE_SHORTDAYDATE2 = 6; |
349
|
|
|
const DAYSTYLE_SHORTDAYDATE3 = 7; |
350
|
|
|
*/ |
351
|
|
|
const DEFAULT_GFORMAT = 'auto'; |
352
|
|
|
const DEFAULT_THEME_CLASS = 'UniversalTheme'; |
353
|
|
|
const DEPTH_BACK = 0; |
354
|
|
|
const DEPTH_FRONT = 1; |
355
|
|
|
const ERR_DEPRECATED = true; |
356
|
|
|
const FF_AHRON = 46; |
357
|
|
|
const FF_ARIAL = 15; |
358
|
|
|
const FF_BIG5 = 32; |
359
|
|
|
const FF_CALCULATOR = 74; |
360
|
|
|
const FF_CHINESE = 31; |
361
|
|
|
const FF_COMIC = 14; |
362
|
|
|
const FF_COMPUTER = 73; |
363
|
|
|
const FF_COURIER = 10; |
364
|
|
|
const FF_DAVID = 44; |
365
|
|
|
const FF_DIGITAL = 72; |
366
|
|
|
const FF_DV_SANSSERIF = self::FF_DEFAULT; |
367
|
|
|
const FF_DV_SANSSERIFCOND = 51; |
368
|
|
|
const FF_DV_SANSSERIFMONO = 49; |
369
|
|
|
const FF_DV_SERIF = 48; |
370
|
|
|
const FF_DV_SERIFCOND = 50; |
371
|
|
|
const FF_FONT0 = 1; |
372
|
|
|
const FF_FONT1 = 2; |
373
|
|
|
const FF_FONT2 = 4; |
374
|
|
|
const FF_GEORGIA = 16; |
375
|
|
|
const FF_GOTHIC = 42; |
376
|
|
|
const FF_MINCHO = 40; |
377
|
|
|
const FF_MIRIAM = 45; |
378
|
|
|
const FF_PGOTHIC = 43; |
379
|
|
|
const FF_PMINCHO = 41; |
380
|
|
|
const FF_SIMSUN = 30; |
381
|
|
|
const FF_TIMES = 12; |
382
|
|
|
const FF_TREBUCHE = 17; |
383
|
|
|
const FF_USERFONT = 90; |
384
|
|
|
const FF_USERFONT1 = 90; |
385
|
|
|
const FF_USERFONT2 = 91; |
386
|
|
|
const FF_USERFONT3 = 92; |
387
|
|
|
const FF_VERA = 18; |
388
|
|
|
const FF_VERAMONO = 19; |
389
|
|
|
const FF_VERASERIF = 20; |
390
|
|
|
const FF_VERDANA = 11; |
391
|
|
|
const FS_BOLD = 9002; |
392
|
|
|
const FS_BOLDIT = 9004; |
393
|
|
|
const FS_BOLDITALIC = 9004; |
394
|
|
|
const FS_ITALIC = 9003; |
395
|
|
|
const FS_NORMAL = 9001; |
396
|
|
|
/* |
397
|
|
|
const GANTT_EVEN = 1; |
398
|
|
|
const GANTT_FROMTOP = 2; |
399
|
|
|
const GANTT_HDAY = 1; |
400
|
|
|
const GANTT_HHOUR = 16; |
401
|
|
|
const GANTT_HMIN = 32; |
402
|
|
|
const GANTT_HMONTH = 4; |
403
|
|
|
const GANTT_HWEEK = 2; |
404
|
|
|
const GANTT_HYEAR = 8; |
405
|
|
|
|
406
|
|
|
*/ |
407
|
|
|
const GOTHIC_TTF_FONT = 'ipag.ttf'; |
408
|
|
|
const GRAD_CENTER = 5; |
409
|
|
|
const GRAD_DIAGONAL = 11; |
410
|
|
|
const GRAD_HOR = 2; |
411
|
|
|
const GRAD_LEFT_REFLECTION = 8; |
412
|
|
|
const GRAD_MIDHOR = 3; |
413
|
|
|
const GRAD_MIDVER = 4; |
414
|
|
|
const GRAD_RAISED_PANEL = 10; |
415
|
|
|
const GRAD_RIGHT_REFLECTION = 9; |
416
|
|
|
const GRAD_VER = 1; |
417
|
|
|
const GRAD_VERT = 1; |
418
|
|
|
const GRAD_WIDE_MIDHOR = 7; |
419
|
|
|
const GRAD_WIDE_MIDVER = 6; |
420
|
|
|
const GREEK_FROM_WINDOWS = false; |
421
|
|
|
const HORIZONTAL = 0; |
422
|
|
|
/* |
423
|
|
|
const HOURADJ_1 = 0 + 30; |
424
|
|
|
const HOURADJ_12 = 5 + 30; |
425
|
|
|
const HOURADJ_2 = 1 + 30; |
426
|
|
|
const HOURADJ_3 = 2 + 30; |
427
|
|
|
const HOURADJ_4 = 3 + 30; |
428
|
|
|
const HOURADJ_6 = 4 + 30; |
429
|
|
|
const HOURSTYLE_CUSTOM = 4; |
430
|
|
|
const HOURSTYLE_H24 = 2; |
431
|
|
|
const HOURSTYLE_HAMPM = 3; |
432
|
|
|
const HOURSTYLE_HM24 = 0; |
433
|
|
|
const HOURSTYLE_HMAMPM = 1;*/ |
434
|
|
|
const INLINE_NO = 0; |
435
|
|
|
const INLINE_YES = 1; |
436
|
|
|
const INSTALL_PHP_ERR_HANDLER = true; |
437
|
|
|
const JPG_VERSION = '3.5.0b1'; |
438
|
|
|
const LABELBKG_NONE = 0; |
439
|
|
|
const LABELBKG_XAXIS = 1; |
440
|
|
|
const LABELBKG_XAXISFULL = 3; |
441
|
|
|
const LABELBKG_XY = 6; |
442
|
|
|
const LABELBKG_XYFULL = 5; |
443
|
|
|
const LABELBKG_YAXIS = 2; |
444
|
|
|
const LABELBKG_YAXISFULL = 4; |
445
|
|
|
|
446
|
|
|
const LEGEND_HOR = 1; |
447
|
|
|
const LEGEND_VERT = 0; |
448
|
|
|
const LINESTYLE_DASHED = 3; |
449
|
|
|
const LINESTYLE_DOTTED = 2; |
450
|
|
|
const LINESTYLE_LONGDASH = 4; |
451
|
|
|
const LINESTYLE_SOLID = 1; |
452
|
|
|
const LOCALE_EN = 'en_UK'; |
453
|
|
|
const LOCALE_SV = 'sv_SE'; |
454
|
|
|
const MARK_CIRCLE = 5; |
455
|
|
|
const MARK_CROSS = 7; |
456
|
|
|
const MARK_DIAMOND = 4; |
457
|
|
|
const MARK_DTRIANGLE = 3; |
458
|
|
|
const MARK_FILLEDCIRCLE = 6; |
459
|
|
|
const MARK_FLAG1 = 14; |
460
|
|
|
const MARK_FLAG2 = 15; |
461
|
|
|
const MARK_FLAG3 = 16; |
462
|
|
|
const MARK_FLAG4 = 17; |
463
|
|
|
const MARK_FLASH = 12; |
464
|
|
|
const MARK_IMG = 13; |
465
|
|
|
const MARK_IMG_BALL = 55; |
466
|
|
|
const MARK_IMG_BEVEL = 58; |
467
|
|
|
const MARK_IMG_DIAMOND = 52; |
468
|
|
|
const MARK_IMG_LBALL = 57; |
469
|
|
|
const MARK_IMG_LPUSHPIN = 51; |
470
|
|
|
const MARK_IMG_MBALL = 56; |
471
|
|
|
const MARK_IMG_PUSHPIN = 50; |
472
|
|
|
const MARK_IMG_SBALL = 55; |
473
|
|
|
const MARK_IMG_SPUSHPIN = 50; |
474
|
|
|
const MARK_IMG_SQUARE = 53; |
475
|
|
|
const MARK_IMG_STAR = 54; |
476
|
|
|
const MARK_LEFTTRIANGLE = 10; |
477
|
|
|
const MARK_RIGHTTRIANGLE = 11; |
478
|
|
|
const MARK_SQUARE = 1; |
479
|
|
|
const MARK_STAR = 8; |
480
|
|
|
const MARK_UTRIANGLE = 2; |
481
|
|
|
const MARK_X = 9; |
482
|
|
|
const MAX_GANTTIMG_SIZE_H = 5000; |
483
|
|
|
const MAX_GANTTIMG_SIZE_W = 8000; |
484
|
|
|
const MBTTF_DIR = '/usr/share/fonts/truetype/'; |
485
|
|
|
const MIN_PHPVERSION = '7.0.0'; |
486
|
|
|
/*const MINADJ_1 = 0 + 20; |
487
|
|
|
const MINADJ_10 = 2 + 20; |
488
|
|
|
const MINADJ_15 = 3 + 20; |
489
|
|
|
const MINADJ_30 = 4 + 20; |
490
|
|
|
const MINADJ_5 = 1 + 20; |
491
|
|
|
const MINUTESTYLE_CUSTOM = 2; |
492
|
|
|
const MINUTESTYLE_MM = 0; |
493
|
|
|
const MONTHADJ_1 = 0 + 20; |
494
|
|
|
const MONTHADJ_6 = 1 + 20; |
495
|
|
|
const MONTHSTYLE_FIRSTLETTER = 6; |
496
|
|
|
const MONTHSTYLE_LONGNAME = 1; |
497
|
|
|
const MONTHSTYLE_LONGNAMEYEAR2 = 2; |
498
|
|
|
const MONTHSTYLE_LONGNAMEYEAR4 = 4; |
499
|
|
|
const MONTHSTYLE_SHORTNAME = 0; |
500
|
|
|
const MONTHSTYLE_SHORTNAMEYEAR2 = 3; |
501
|
|
|
const MONTHSTYLE_SHORTNAMEYEAR4 = 5;*/ |
502
|
|
|
|
503
|
|
|
/*const SECADJ_1 = 0; |
504
|
|
|
const SECADJ_10 = 2; |
505
|
|
|
const SECADJ_15 = 3; |
506
|
|
|
const SECADJ_30 = 4; |
507
|
|
|
const SECADJ_5 = 1; |
508
|
|
|
const SECPERDAY = 86400; |
509
|
|
|
const SECPERHOUR = 3600; |
510
|
|
|
const SECPERMIN = 60; |
511
|
|
|
const SECPERYEAR = 31536000;*/ |
512
|
|
|
const SIDE_BOTTOM = -1; |
513
|
|
|
const SIDE_DOWN = -1; |
514
|
|
|
const SIDE_LEFT = -1; |
515
|
|
|
const SIDE_RIGHT = 1; |
516
|
|
|
const SIDE_TOP = 1; |
517
|
|
|
const SIDE_UP = 1; |
518
|
|
|
const SKEW3D_DOWN = 1; |
519
|
|
|
const SKEW3D_LEFT = 2; |
520
|
|
|
const SKEW3D_RIGHT = 3; |
521
|
|
|
const SKEW3D_UP = 0; |
522
|
|
|
const SUPERSAMPLING = true; |
523
|
|
|
const SUPERSAMPLING_SCALE = 1; |
524
|
|
|
const TABTITLE_WIDTHFIT = 0; |
525
|
|
|
const TABTITLE_WIDTHFULL = -1; |
526
|
|
|
const TICKD_DENSE = 1; |
527
|
|
|
const TICKD_NORMAL = 2; |
528
|
|
|
const TICKD_SPARSE = 3; |
529
|
|
|
const TICKD_VERYSPARSE = 4; |
530
|
|
|
const TITLEBKG_FILLSTYLE_HSTRIPED = 1; |
531
|
|
|
const TITLEBKG_FILLSTYLE_SOLID = 3; |
532
|
|
|
const TITLEBKG_FILLSTYLE_VSTRIPED = 2; |
533
|
|
|
const TITLEBKG_FRAME_BEVEL = 3; |
534
|
|
|
const TITLEBKG_FRAME_BOTTOM = 2; |
535
|
|
|
const TITLEBKG_FRAME_FULL = 1; |
536
|
|
|
const TITLEBKG_FRAME_NONE = 0; |
537
|
|
|
const TITLEBKG_STYLE1 = 1; |
538
|
|
|
const TITLEBKG_STYLE2 = 2; |
539
|
|
|
const TITLEBKG_STYLE3 = 3; |
540
|
|
|
const TTF_DIR = '/usr/share/fonts/truetype/'; |
541
|
|
|
const USE_LIBRARY_IMAGETTFBBOX = true; |
542
|
|
|
const VERTICAL = 1; |
543
|
|
|
/*const Configs::WEEKSTYLE_FIRSTDAY = 1; |
544
|
|
|
const WEEKSTYLE_FIRSTDAY2 = 2; |
545
|
|
|
const WEEKSTYLE_FIRSTDAY2WNBR = 4; |
546
|
|
|
const WEEKSTYLE_FIRSTDAYWNBR = 3; |
547
|
|
|
const WEEKSTYLE_WNBR = 0;*/ |
548
|
|
|
/*const Configs::YEARADJ_1 = 0 + 30; |
549
|
|
|
const YEARADJ_2 = 1 + 30; |
550
|
|
|
const YEARADJ_5 = 2 + 30;*/ |
551
|
|
|
public static $FOUND_FONTS = []; |
552
|
|
|
|
553
|
|
|
protected static $lazy_statics = [ |
554
|
|
|
'AXSTYLE_BOXIN' => self::AXSTYLE_BOXIN, |
555
|
|
|
'AXSTYLE_BOXOUT' => self::AXSTYLE_BOXOUT, |
556
|
|
|
'AXSTYLE_SIMPLE' => self::AXSTYLE_SIMPLE, |
557
|
|
|
'AXSTYLE_YBOXIN' => self::AXSTYLE_YBOXIN, |
558
|
|
|
'AXSTYLE_YBOXOUT' => self::AXSTYLE_YBOXOUT, |
559
|
|
|
'BGIMG_CENTER' => self::BGIMG_CENTER, |
560
|
|
|
'BGIMG_COPY' => self::BGIMG_COPY, |
561
|
|
|
'BGIMG_FILLFRAME' => self::BGIMG_FILLFRAME, |
562
|
|
|
'BGIMG_FILLPLOT' => self::BGIMG_FILLPLOT, |
563
|
|
|
'BGIMG_FREE' => self::BGIMG_FREE, |
564
|
|
|
'BGRAD_FRAME' => self::BGRAD_FRAME, |
565
|
|
|
'BGRAD_MARGIN' => self::BGRAD_MARGIN, |
566
|
|
|
'BGRAD_PLOT' => self::BGRAD_PLOT, |
567
|
|
|
'CATCH_PHPERRMSG' => self::CATCH_PHPERRMSG, |
568
|
|
|
'CHINESE_TTF_FONT' => self::CHINESE_TTF_FONT, |
569
|
|
|
'CSIMCACHE_DIR' => self::CSIMCACHE_DIR, |
570
|
|
|
'CSIMCACHE_HTTP_DIR' => self::CSIMCACHE_HTTP_DIR, |
571
|
|
|
'DEFAULT_ERR_LOCALE' => 'en', |
572
|
|
|
'DEFAULT_GFORMAT' => self::DEFAULT_GFORMAT, |
573
|
|
|
'DEFAULT_THEME_CLASS' => self::DEFAULT_THEME_CLASS, |
574
|
|
|
'DEPTH_BACK' => self::DEPTH_BACK, |
575
|
|
|
'DEPTH_FRONT' => self::DEPTH_FRONT, |
576
|
|
|
'ERR_DEPRECATED' => self::ERR_DEPRECATED, |
577
|
|
|
'FF_AHRON' => self::FF_AHRON, |
578
|
|
|
'FF_ARIAL' => self::FF_ARIAL, |
579
|
|
|
'FF_BIG5' => self::FF_BIG5, |
580
|
|
|
'FF_CALCULATOR' => self::FF_CALCULATOR, |
581
|
|
|
'FF_CHINESE' => self::FF_CHINESE, |
582
|
|
|
'FF_COMIC' => self::FF_COMIC, |
583
|
|
|
'FF_COMPUTER' => self::FF_COMPUTER, |
584
|
|
|
'FF_COURIER' => self::FF_COURIER, |
585
|
|
|
'FF_DAVID' => self::FF_DAVID, |
586
|
|
|
'FF_DIGITAL' => self::FF_DIGITAL, |
587
|
|
|
'FF_DV_SANSSERIF' => self::FF_DV_SANSSERIF, |
588
|
|
|
'FF_DV_SANSSERIFCOND' => self::FF_DV_SANSSERIFCOND, |
589
|
|
|
'FF_DV_SANSSERIFMONO' => self::FF_DV_SANSSERIFMONO, |
590
|
|
|
'FF_DV_SERIF' => self::FF_DV_SERIF, |
591
|
|
|
'FF_DV_SERIFCOND' => self::FF_DV_SERIFCOND, |
592
|
|
|
'FF_FONT0' => self::FF_FONT0, |
593
|
|
|
'FF_FONT1' => self::FF_FONT1, |
594
|
|
|
'FF_FONT2' => self::FF_FONT2, |
595
|
|
|
'FF_GEORGIA' => self::FF_GEORGIA, |
596
|
|
|
'FF_GOTHIC' => self::FF_GOTHIC, |
597
|
|
|
'FF_MINCHO' => self::FF_MINCHO, |
598
|
|
|
'FF_MIRIAM' => self::FF_MIRIAM, |
599
|
|
|
'FF_PGOTHIC' => self::FF_PGOTHIC, |
600
|
|
|
'FF_PMINCHO' => self::FF_PMINCHO, |
601
|
|
|
'FF_SIMSUN' => self::FF_SIMSUN, |
602
|
|
|
'FF_TIMES' => self::FF_TIMES, |
603
|
|
|
'FF_TREBUCHE' => self::FF_TREBUCHE, |
604
|
|
|
'FF_USERFONT' => self::FF_USERFONT, |
605
|
|
|
'FF_USERFONT1' => self::FF_USERFONT1, |
606
|
|
|
'FF_USERFONT2' => self::FF_USERFONT2, |
607
|
|
|
'FF_USERFONT3' => self::FF_USERFONT3, |
608
|
|
|
'FF_VERA' => self::FF_VERA, |
609
|
|
|
'FF_VERAMONO' => self::FF_VERAMONO, |
610
|
|
|
'FF_VERASERIF' => self::FF_VERASERIF, |
611
|
|
|
'FF_VERDANA' => self::FF_VERDANA, |
612
|
|
|
'FS_BOLD' => self::FS_BOLD, |
613
|
|
|
'FS_BOLDIT' => self::FS_BOLDIT, |
614
|
|
|
'FS_BOLDITALIC' => self::FS_BOLDITALIC, |
615
|
|
|
'FS_ITALIC' => self::FS_ITALIC, |
616
|
|
|
'FS_NORMAL' => self::FS_NORMAL, |
617
|
|
|
'GOTHIC_TTF_FONT' => self::GOTHIC_TTF_FONT, |
618
|
|
|
'GRAD_CENTER' => self::GRAD_CENTER, |
619
|
|
|
'GRAD_DIAGONAL' => self::GRAD_DIAGONAL, |
620
|
|
|
'GRAD_HOR' => self::GRAD_HOR, |
621
|
|
|
'GRAD_LEFT_REFLECTION' => self::GRAD_LEFT_REFLECTION, |
622
|
|
|
'GRAD_MIDHOR' => self::GRAD_MIDHOR, |
623
|
|
|
'GRAD_MIDVER' => self::GRAD_MIDVER, |
624
|
|
|
'GRAD_RAISED_PANEL' => self::GRAD_RAISED_PANEL, |
625
|
|
|
'GRAD_RIGHT_REFLECTION' => self::GRAD_RIGHT_REFLECTION, |
626
|
|
|
'GRAD_VER' => self::GRAD_VER, |
627
|
|
|
'GRAD_VERT' => self::GRAD_VERT, |
628
|
|
|
'GRAD_WIDE_MIDHOR' => self::GRAD_WIDE_MIDHOR, |
629
|
|
|
'GRAD_WIDE_MIDVER' => self::GRAD_WIDE_MIDVER, |
630
|
|
|
'HORIZONTAL' => self::HORIZONTAL, |
631
|
|
|
'INLINE_NO' => self::INLINE_NO, |
632
|
|
|
'INLINE_YES' => self::INLINE_YES, |
633
|
|
|
'INSTALL_PHP_ERR_HANDLER' => self::INSTALL_PHP_ERR_HANDLER, |
634
|
|
|
'JPG_VERSION' => self::JPG_VERSION, |
635
|
|
|
'LABELBKG_NONE' => self::LABELBKG_NONE, |
636
|
|
|
'LABELBKG_XAXIS' => self::LABELBKG_XAXIS, |
637
|
|
|
'LABELBKG_XAXISFULL' => self::LABELBKG_XAXISFULL, |
638
|
|
|
'LABELBKG_XY' => self::LABELBKG_XY, |
639
|
|
|
'LABELBKG_XYFULL' => self::LABELBKG_XYFULL, |
640
|
|
|
'LABELBKG_YAXIS' => self::LABELBKG_YAXIS, |
641
|
|
|
'LABELBKG_YAXISFULL' => self::LABELBKG_YAXISFULL, |
642
|
|
|
|
643
|
|
|
'LEGEND_HOR' => self::LEGEND_HOR, |
644
|
|
|
'LEGEND_VERT' => self::LEGEND_VERT, |
645
|
|
|
'LINESTYLE_DASHED' => self::LINESTYLE_DASHED, |
646
|
|
|
'LINESTYLE_DOTTED' => self::LINESTYLE_DOTTED, |
647
|
|
|
'LINESTYLE_LONGDASH' => self::LINESTYLE_LONGDASH, |
648
|
|
|
'LINESTYLE_SOLID' => self::LINESTYLE_SOLID, |
649
|
|
|
'LOCALE_EN' => self::LOCALE_EN, |
650
|
|
|
'LOCALE_SV' => self::LOCALE_SV, |
651
|
|
|
'MARK_CIRCLE' => self::MARK_CIRCLE, |
652
|
|
|
'MARK_CROSS' => self::MARK_CROSS, |
653
|
|
|
'MARK_DIAMOND' => self::MARK_DIAMOND, |
654
|
|
|
'MARK_DTRIANGLE' => self::MARK_DTRIANGLE, |
655
|
|
|
'MARK_FILLEDCIRCLE' => self::MARK_FILLEDCIRCLE, |
656
|
|
|
'MARK_FLAG1' => self::MARK_FLAG1, |
657
|
|
|
'MARK_FLAG2' => self::MARK_FLAG2, |
658
|
|
|
'MARK_FLAG3' => self::MARK_FLAG3, |
659
|
|
|
'MARK_FLAG4' => self::MARK_FLAG4, |
660
|
|
|
'MARK_FLASH' => self::MARK_FLASH, |
661
|
|
|
'MARK_IMG' => self::MARK_IMG, |
662
|
|
|
'MARK_IMG_BALL' => self::MARK_IMG_BALL, |
663
|
|
|
'MARK_IMG_BEVEL' => self::MARK_IMG_BEVEL, |
664
|
|
|
'MARK_IMG_DIAMOND' => self::MARK_IMG_DIAMOND, |
665
|
|
|
|
666
|
|
|
'MARK_IMG_LPUSHPIN' => self::MARK_IMG_LPUSHPIN, |
667
|
|
|
'MARK_IMG_MBALL' => self::MARK_IMG_MBALL, |
668
|
|
|
'MARK_IMG_PUSHPIN' => self::MARK_IMG_PUSHPIN, |
669
|
|
|
'MARK_IMG_SBALL' => self::MARK_IMG_SBALL, |
670
|
|
|
'MARK_IMG_SPUSHPIN' => self::MARK_IMG_SPUSHPIN, |
671
|
|
|
'MARK_IMG_SQUARE' => self::MARK_IMG_SQUARE, |
672
|
|
|
'MARK_IMG_STAR' => self::MARK_IMG_STAR, |
673
|
|
|
'MARK_LEFTTRIANGLE' => self::MARK_LEFTTRIANGLE, |
674
|
|
|
'MARK_RIGHTTRIANGLE' => self::MARK_RIGHTTRIANGLE, |
675
|
|
|
'MARK_SQUARE' => self::MARK_SQUARE, |
676
|
|
|
'MARK_STAR' => self::MARK_STAR, |
677
|
|
|
'MARK_UTRIANGLE' => self::MARK_UTRIANGLE, |
678
|
|
|
'MARK_X' => self::MARK_X, |
679
|
|
|
'MAX_GANTTIMG_SIZE_H' => self::MAX_GANTTIMG_SIZE_H, |
680
|
|
|
'MAX_GANTTIMG_SIZE_W' => self::MAX_GANTTIMG_SIZE_W, |
681
|
|
|
'MBTTF_DIR' => self::MBTTF_DIR, |
682
|
|
|
|
683
|
|
|
'MIN_PHPVERSION' => self::MIN_PHPVERSION, |
684
|
|
|
'READ_CACHE' => self::READ_CACHE, |
685
|
|
|
'SIDE_BOTTOM' => self::SIDE_BOTTOM, |
686
|
|
|
'SIDE_DOWN' => self::SIDE_DOWN, |
687
|
|
|
'SIDE_LEFT' => self::SIDE_LEFT, |
688
|
|
|
'SIDE_RIGHT' => self::SIDE_RIGHT, |
689
|
|
|
'SIDE_TOP' => self::SIDE_TOP, |
690
|
|
|
'SIDE_UP' => self::SIDE_UP, |
691
|
|
|
'SKEW3D_DOWN' => self::SKEW3D_DOWN, |
692
|
|
|
'SKEW3D_LEFT' => self::SKEW3D_LEFT, |
693
|
|
|
'SKEW3D_RIGHT' => self::SKEW3D_RIGHT, |
694
|
|
|
'SKEW3D_UP' => self::SKEW3D_UP, |
695
|
|
|
'SUPERSAMPLING' => self::SUPERSAMPLING, |
696
|
|
|
'SUPERSAMPLING_SCALE' => self::SUPERSAMPLING_SCALE, |
697
|
|
|
'TABTITLE_WIDTHFIT' => self::TABTITLE_WIDTHFIT, |
698
|
|
|
'TABTITLE_WIDTHFULL' => self::TABTITLE_WIDTHFULL, |
699
|
|
|
'TICKD_DENSE' => self::TICKD_DENSE, |
700
|
|
|
'TICKD_NORMAL' => self::TICKD_NORMAL, |
701
|
|
|
'TICKD_SPARSE' => self::TICKD_SPARSE, |
702
|
|
|
'TICKD_VERYSPARSE' => self::TICKD_VERYSPARSE, |
703
|
|
|
'TITLEBKG_FILLSTYLE_HSTRIPED' => self::TITLEBKG_FILLSTYLE_HSTRIPED, |
704
|
|
|
'TITLEBKG_FILLSTYLE_SOLID' => self::TITLEBKG_FILLSTYLE_SOLID, |
705
|
|
|
'TITLEBKG_FILLSTYLE_VSTRIPED' => self::TITLEBKG_FILLSTYLE_VSTRIPED, |
706
|
|
|
'TITLEBKG_FRAME_BEVEL' => self::TITLEBKG_FRAME_BEVEL, |
707
|
|
|
'TITLEBKG_FRAME_BOTTOM' => self::TITLEBKG_FRAME_BOTTOM, |
708
|
|
|
'TITLEBKG_FRAME_FULL' => self::TITLEBKG_FRAME_FULL, |
709
|
|
|
'TITLEBKG_FRAME_NONE' => self::TITLEBKG_FRAME_NONE, |
710
|
|
|
'TITLEBKG_STYLE1' => self::TITLEBKG_STYLE1, |
711
|
|
|
'TITLEBKG_STYLE2' => self::TITLEBKG_STYLE2, |
712
|
|
|
'TITLEBKG_STYLE3' => self::TITLEBKG_STYLE3, |
713
|
|
|
'USE_IMAGE_ERROR_HANDLER' => null, //self::USE_IMAGE_ERROR_HANDLER, |
714
|
|
|
'USE_LIBRARY_IMAGETTFBBOX' => self::USE_LIBRARY_IMAGETTFBBOX, |
715
|
|
|
'VERTICAL' => self::VERTICAL, |
716
|
|
|
'_DEFAULT_LPM_SIZE' => (8), // Default Legend Plot Mark size, |
717
|
|
|
// For internal use only |
718
|
|
|
'_JPG_DEBUG' => (false), |
719
|
|
|
'_FORCE_IMGTOFILE' => (false), |
720
|
|
|
'_FORCE_IMGDIR' => ('/tmp/jpgimg/'), |
721
|
|
|
'CACHE_DIR' => null, |
722
|
|
|
'TTF_DIR' => null, |
723
|
|
|
'MBTTF_DIR' => null, |
724
|
|
|
'CSIMCACHE_DIR' => null, |
725
|
|
|
'CSIMCACHE_HTTP_DIR' => null, |
726
|
|
|
// Special file name to indicate that we only want to calc |
727
|
|
|
// the image map in the call to Graph::Stroke() used |
728
|
|
|
// internally from the GetHTMLCSIM() method. |
729
|
|
|
'_CSIM_SPECIALFILE' => ('_csim_special_'), |
730
|
|
|
|
731
|
|
|
// HTTP GET argument that is used with image map |
732
|
|
|
// to indicate to the script to just generate the image |
733
|
|
|
// and not the full CSIM HTML page. |
734
|
|
|
'_CSIM_DISPLAY' => ('_jpg_csimd'), |
735
|
|
|
|
736
|
|
|
// Special filename for Graph::Stroke(). If this filename is given |
737
|
|
|
// then the image will NOT be streamed to browser of file. Instead the |
738
|
|
|
// Stroke call will return the handler for the created GD image. |
739
|
|
|
'_IMG_HANDLER' => ('__handle'), |
740
|
|
|
|
741
|
|
|
// Special filename for Graph::Stroke(). If this filename is given |
742
|
|
|
// the image will be stroked to a file with a name based on the script name. |
743
|
|
|
'_IMG_AUTO' => ('auto'), |
744
|
|
|
]; |
745
|
|
|
private static $active_lazy_statics = []; |
746
|
|
|
private static $Instance; |
747
|
|
|
|
748
|
|
|
/** |
749
|
|
|
* @see https://www.php.net/manual/en/language.oop5.overloading.php#language.oop5.overloading.methods |
750
|
|
|
* This workaround allows to access JPGraph constants |
751
|
|
|
* as if they were static properties of this class in the form |
752
|
|
|
* |
753
|
|
|
* ``` |
754
|
|
|
* $ttf_folder = \Configs::TTF_FOLDER |
755
|
|
|
* ``` |
756
|
|
|
* |
757
|
|
|
* Same goes for setting the default value; |
758
|
|
|
* |
759
|
|
|
* ``` |
760
|
|
|
* \Configs::TTF_FOLDER('/var/www') |
761
|
|
|
* ``` |
762
|
|
|
* |
763
|
|
|
* It will only handle constant names from an internal whitelist, |
764
|
|
|
* and accept setters only for scalars. |
765
|
|
|
* |
766
|
|
|
* and wreak havoc otherwise. { (╯°□°)╯︵ ┻━┻ } |
767
|
|
|
* |
768
|
|
|
* @param string $const_name The constant's name |
769
|
|
|
* @param mixed $value the value to set, if passed and admissible |
770
|
|
|
*/ |
771
|
|
|
public static function __callStatic(string $const_name, array $args) |
772
|
|
|
{ |
773
|
|
|
/* |
774
|
|
|
* Not a constant/static that we know of |
775
|
|
|
*/ |
776
|
|
|
if (!array_key_exists($const_name, self::$lazy_statics) |
777
|
|
|
) { |
778
|
|
|
throw new Exception(sprintf('You requested an unknown constant "%s"', $const_name)); |
779
|
|
|
} |
780
|
|
|
/* |
781
|
|
|
* It's a static that we know of, we'll check if the calling class is trying |
782
|
|
|
* to set or get its value |
783
|
|
|
*/ |
784
|
|
|
return $args && is_scalar($args) ? self::setConfig($const_name, $args) : self::getConfig($const_name); |
|
|
|
|
785
|
|
|
} |
786
|
|
|
|
787
|
|
|
public function __get($config_key) {} |
788
|
|
|
|
789
|
|
|
public static function getInstance() |
790
|
|
|
{ |
791
|
|
|
if (self::$Instance) { |
792
|
|
|
return; |
793
|
|
|
} |
794
|
|
|
|
795
|
|
|
self::$Instance = new self(); |
796
|
|
|
} |
797
|
|
|
|
798
|
|
|
/** |
799
|
|
|
* If they're trying to set the value, only allow it |
800
|
|
|
* if it isn't previously set. |
801
|
|
|
* |
802
|
|
|
* @param string $config_key The config_key name |
803
|
|
|
* @param mixed $config_value The config_value value |
804
|
|
|
* |
805
|
|
|
* @return <type> ( description_of_the_return_value ) |
|
|
|
|
806
|
|
|
*/ |
807
|
|
|
protected static function setConfig(string $config_key, $config_value) |
808
|
|
|
{ |
809
|
|
|
// Environment variable takes precedence |
810
|
|
|
if (getenv(sprintf('JPGRAPH_%s', $config_key))) { |
811
|
|
|
return getenv(sprintf('JPGRAPH_%s', $config_key)); |
812
|
|
|
} |
813
|
|
|
// Local or inherited class constants come next |
814
|
|
|
if (defined(sprintf('static::%s', $config_key))) { |
815
|
|
|
return constant(sprintf('static::%s', $config_key)); |
816
|
|
|
} |
817
|
|
|
// Global constants in third place |
818
|
|
|
if (defined($config_key)) { |
819
|
|
|
return constant($config_key); |
820
|
|
|
} |
821
|
|
|
// look for a static member of $lazy_statics |
822
|
|
|
// It not found, it's an error |
823
|
|
|
if (!array_key_exists($config_key, static::$lazy_statics)) { |
824
|
|
|
throw new Exception(sprintf('You tried to set an unknown config_key "%s"', $config_key)); |
825
|
|
|
} |
826
|
|
|
|
827
|
|
|
static::$active_lazy_statics[$config_key] = is_scalar($config_value) ? $config_value : self::$lazy_statics[$config_key]; |
|
|
|
|
828
|
|
|
|
829
|
|
|
return static::$active_lazy_statics[$config_key]; |
830
|
|
|
} |
831
|
|
|
|
832
|
|
|
/** |
833
|
|
|
* If trying to get the constant value, return the current one |
834
|
|
|
* or set it as the default declared in $lazy_statics. |
835
|
|
|
* |
836
|
|
|
* @param string $config_key The config_key name |
837
|
|
|
* |
838
|
|
|
* @throws Exception (description) |
839
|
|
|
* |
840
|
|
|
* @return array the constant |
841
|
|
|
*/ |
842
|
|
|
public static function getConfig(string $config_key) |
843
|
|
|
{ |
844
|
|
|
// Environment variable takes precedence |
845
|
|
|
if (getenv(sprintf('JPGRAPH_%s', $config_key))) { |
846
|
|
|
return getenv(sprintf('JPGRAPH_%s', $config_key)); |
|
|
|
|
847
|
|
|
} |
848
|
|
|
// Local or inherited class constants come next |
849
|
|
|
if (defined(sprintf('static::%s', $config_key))) { |
850
|
|
|
return constant(sprintf('static::%s', $config_key)); |
851
|
|
|
} |
852
|
|
|
// Global constants in third place |
853
|
|
|
if (defined($config_key)) { |
854
|
|
|
return constant($config_key); |
855
|
|
|
} |
856
|
|
|
// Only chance left is to look for a static member of $lazy_statics |
857
|
|
|
// It not found, it's an error |
858
|
|
|
if (!array_key_exists($config_key, static::$lazy_statics)) { |
859
|
|
|
throw new Exception(sprintf('You requested an unknown config_key "%s"', $config_key)); |
860
|
|
|
} |
861
|
|
|
// If found, and not set, use the default value |
862
|
|
|
if (!array_key_exists($const_name, static::$active_lazy_statics)) { |
|
|
|
|
863
|
|
|
static::$active_lazy_statics[$const_name] = static::$lazy_statics[$const_name]; |
864
|
|
|
} |
865
|
|
|
// Finally, return said static |
866
|
|
|
return static::$active_lazy_statics[$const_name]; |
867
|
|
|
} |
868
|
|
|
|
869
|
|
|
/** |
870
|
|
|
* Returns the item count of the variable, or zero if it's non countable. |
871
|
|
|
* |
872
|
|
|
* @param mixed $var The variable whose items we want to count |
873
|
|
|
*/ |
874
|
|
|
public static function safe_count($var) |
875
|
|
|
{ |
876
|
|
|
if (is_countable($var)) { |
877
|
|
|
return count($var); |
878
|
|
|
} |
879
|
|
|
|
880
|
|
|
return 0; |
881
|
|
|
} |
882
|
|
|
|
883
|
|
|
public static function setGeneralConfigs() |
884
|
|
|
{ |
885
|
|
|
self::setConfig('DEFAULT_ERR_LOCALE', 'en'); |
886
|
|
|
// Automatic settings of path for cache and font directory |
887
|
|
|
// if they have not been previously specified |
888
|
|
|
// Locales. ONLY KEPT FOR BACKWARDS COMPATIBILITY |
889
|
|
|
// You should use the proper locale strings directly |
890
|
|
|
// from now on. |
891
|
|
|
self::setConfig('LOCALE_EN', 'en_UK'); |
892
|
|
|
self::setConfig('LOCALE_SV', 'sv_SE'); |
893
|
|
|
|
894
|
|
|
// Determine if the error handler should be image based or purely |
895
|
|
|
// text based. Image based makes it easier since the script will |
896
|
|
|
// always return an image even in case of errors. |
897
|
|
|
self::setConfig('USE_IMAGE_ERROR_HANDLER', true); |
898
|
|
|
|
899
|
|
|
// Should the library examine the global php_errmsg string and convert |
900
|
|
|
// any error in it to a graphical representation. This is handy for the |
901
|
|
|
// occasions when, for example, header files cannot be found and this results |
902
|
|
|
// in the graph not being created and just a 'red-cross' image would be seen. |
903
|
|
|
// This should be turned off for a production site. |
904
|
|
|
self::setConfig('CATCH_PHPERRMSG', true); |
905
|
|
|
|
906
|
|
|
// Determine if the library should also setup the default PHP |
907
|
|
|
// error handler to generate a graphic error mesage. This is useful |
908
|
|
|
// during development to be able to see the error message as an image |
909
|
|
|
// instead as a 'red-cross' in a page where an image is expected. |
910
|
|
|
self::setConfig('INSTALL_PHP_ERR_HANDLER', false); |
911
|
|
|
|
912
|
|
|
// Should usage of deprecated functions and parameters give a fatal error? |
913
|
|
|
// (Useful to check if code is future proof.) |
914
|
|
|
self::setConfig('ERR_DEPRECATED', true); |
915
|
|
|
|
916
|
|
|
// Default theme class name |
917
|
|
|
self::setConfig('DEFAULT_THEME_CLASS', 'UniversalTheme'); |
918
|
|
|
|
919
|
|
|
self::setConfig('SUPERSAMPLING', true); |
920
|
|
|
self::setConfig('SUPERSAMPLING_SCALE', 1); |
921
|
|
|
|
922
|
|
|
// Default font family |
923
|
|
|
self::setConfig('FF_DV_SANSSERIF', self::FF_DEFAULT); |
924
|
|
|
|
925
|
|
|
// The DEFAULT_GFORMAT sets the default graphic encoding format, i.e. |
926
|
|
|
// PNG, JPG or GIF depending on what is installed on the target system |
927
|
|
|
// in that order. |
928
|
|
|
self::setConfig('DEFAULT_GFORMAT', 'auto'); |
929
|
|
|
|
930
|
|
|
// Version info |
931
|
|
|
self::setConfig('JPG_VERSION', '3.5.0b1'); |
932
|
|
|
|
933
|
|
|
// Minimum required PHP version |
934
|
|
|
self::setConfig('MIN_PHPVERSION', '7.0.0'); |
935
|
|
|
} |
936
|
|
|
|
937
|
|
|
public static function verifyFontConfigs() |
938
|
|
|
{ |
939
|
|
|
// A huge lot of font constants |
940
|
|
|
// TTF Font families |
941
|
|
|
self::setConfig('FF_COURIER', 10); |
942
|
|
|
self::setConfig('FF_VERDANA', 11); |
943
|
|
|
self::setConfig('FF_TIMES', 12); |
944
|
|
|
self::setConfig('FF_COMIC', 14); |
945
|
|
|
self::setConfig('FF_ARIAL', 15); |
946
|
|
|
self::setConfig('FF_GEORGIA', 16); |
947
|
|
|
self::setConfig('FF_TREBUCHE', 17); |
948
|
|
|
|
949
|
|
|
// Gnome Vera font |
950
|
|
|
// Available from http://www.gnome.org/fonts/ |
951
|
|
|
self::setConfig('FF_VERA', 18); |
952
|
|
|
self::setConfig('FF_VERAMONO', 19); |
953
|
|
|
self::setConfig('FF_VERASERIF', 20); |
954
|
|
|
|
955
|
|
|
// Chinese font |
956
|
|
|
self::setConfig('FF_SIMSUN', 30); |
957
|
|
|
self::setConfig('FF_CHINESE', 31); |
958
|
|
|
self::setConfig('FF_BIG5', 32); |
959
|
|
|
|
960
|
|
|
// Japanese font |
961
|
|
|
self::setConfig('FF_MINCHO', 40); |
962
|
|
|
self::setConfig('FF_PMINCHO', 41); |
963
|
|
|
self::setConfig('FF_GOTHIC', 42); |
964
|
|
|
self::setConfig('FF_PGOTHIC', 43); |
965
|
|
|
|
966
|
|
|
// Hebrew fonts |
967
|
|
|
self::setConfig('FF_DAVID', 44); |
968
|
|
|
self::setConfig('FF_MIRIAM', 45); |
969
|
|
|
self::setConfig('FF_AHRON', 46); |
970
|
|
|
|
971
|
|
|
// Dejavu-fonts http://sourceforge.net/projects/dejavu |
972
|
|
|
self::setConfig('FF_DV_SANSSERIF', 47); |
973
|
|
|
self::setConfig('FF_DV_SERIF', 48); |
974
|
|
|
self::setConfig('FF_DV_SANSSERIFMONO', 49); |
975
|
|
|
self::setConfig('FF_DV_SERIFCOND', 50); |
976
|
|
|
self::setConfig('FF_DV_SANSSERIFCOND', 51); |
977
|
|
|
|
978
|
|
|
// Extra fonts |
979
|
|
|
// Download fonts from |
980
|
|
|
// http://www.webfontlist.com |
981
|
|
|
// http://www.webpagepublicity.com/free-fonts.html |
982
|
|
|
// http://www.fontonic.com/fonts.asp?width=d&offset=120 |
983
|
|
|
// http://www.fontspace.com/category/famous |
984
|
|
|
|
985
|
|
|
// define("FF_SPEEDO",71); // This font is also known as Bauer (Used for development gauge fascia) |
986
|
|
|
self::setConfig('FF_DIGITAL', 72); // Digital readout font |
987
|
|
|
self::setConfig('FF_COMPUTER', 73); // The classic computer font |
988
|
|
|
self::setConfig('FF_CALCULATOR', 74); // Triad font |
989
|
|
|
|
990
|
|
|
self::setConfig('FF_USERFONT', 90); |
991
|
|
|
self::setConfig('FF_USERFONT1', 90); |
992
|
|
|
self::setConfig('FF_USERFONT2', 91); |
993
|
|
|
self::setConfig('FF_USERFONT3', 92); |
994
|
|
|
|
995
|
|
|
// Limits for fonts |
996
|
|
|
|
997
|
|
|
// TTF Font styles |
998
|
|
|
self::setConfig('FS_NORMAL', 9001); |
999
|
|
|
self::setConfig('FS_BOLD', 9002); |
1000
|
|
|
self::setConfig('FS_ITALIC', 9003); |
1001
|
|
|
self::setConfig('FS_BOLDIT', 9004); |
1002
|
|
|
self::setConfig('FS_BOLDITALIC', 9004); |
1003
|
|
|
|
1004
|
|
|
//Definitions for internal font |
1005
|
|
|
self::setConfig('FF_FONT0', 1); |
1006
|
|
|
self::setConfig('FF_FONT1', 2); |
1007
|
|
|
self::setConfig('FF_FONT2', 4); |
1008
|
|
|
|
1009
|
|
|
// Line styles |
1010
|
|
|
self::setConfig('LINESTYLE_SOLID', 1); |
1011
|
|
|
self::setConfig('LINESTYLE_DOTTED', 2); |
1012
|
|
|
self::setConfig('LINESTYLE_DASHED', 3); |
1013
|
|
|
self::setConfig('LINESTYLE_LONGDASH', 4); |
1014
|
|
|
|
1015
|
|
|
// Styles for gradient color fill |
1016
|
|
|
self::setConfig('GRAD_VER', 1); |
1017
|
|
|
self::setConfig('GRAD_VERT', 1); |
1018
|
|
|
self::setConfig('GRAD_HOR', 2); |
1019
|
|
|
self::setConfig('GRAD_MIDHOR', 3); |
1020
|
|
|
self::setConfig('GRAD_MIDVER', 4); |
1021
|
|
|
self::setConfig('GRAD_CENTER', 5); |
1022
|
|
|
self::setConfig('GRAD_WIDE_MIDVER', 6); |
1023
|
|
|
self::setConfig('GRAD_WIDE_MIDHOR', 7); |
1024
|
|
|
self::setConfig('GRAD_LEFT_REFLECTION', 8); |
1025
|
|
|
self::setConfig('GRAD_RIGHT_REFLECTION', 9); |
1026
|
|
|
self::setConfig('GRAD_RAISED_PANEL', 10); |
1027
|
|
|
self::setConfig('GRAD_DIAGONAL', 11); |
1028
|
|
|
|
1029
|
|
|
// Special file name to indicate that we only want to calc |
1030
|
|
|
// the image map in the call to Graph::Stroke() used |
1031
|
|
|
// internally from the GetHTMLCSIM() method. |
1032
|
|
|
|
1033
|
|
|
// HTTP GET argument that is used with image map |
1034
|
|
|
// to indicate to the script to just generate the image |
1035
|
|
|
// and not the full CSIM HTML page. |
1036
|
|
|
|
1037
|
|
|
// Special filename for Graph::Stroke(). If this filename is given |
1038
|
|
|
// then the image will NOT be streamed to browser of file. Instead the |
1039
|
|
|
// Stroke call will return the handler for the created GD image. |
1040
|
|
|
|
1041
|
|
|
// Special filename for Graph::Stroke(). If this filename is given |
1042
|
|
|
// the image will be stroked to a file with a name based on the script name. |
1043
|
|
|
|
1044
|
|
|
// Tick density |
1045
|
|
|
self::setConfig('TICKD_DENSE', 1); |
1046
|
|
|
self::setConfig('TICKD_NORMAL', 2); |
1047
|
|
|
self::setConfig('TICKD_SPARSE', 3); |
1048
|
|
|
self::setConfig('TICKD_VERYSPARSE', 4); |
1049
|
|
|
|
1050
|
|
|
// Side for ticks and labels. |
1051
|
|
|
self::setConfig('SIDE_LEFT', -1); |
1052
|
|
|
self::setConfig('SIDE_RIGHT', 1); |
1053
|
|
|
self::setConfig('SIDE_DOWN', -1); |
1054
|
|
|
self::setConfig('SIDE_BOTTOM', -1); |
1055
|
|
|
self::setConfig('SIDE_UP', 1); |
1056
|
|
|
self::setConfig('SIDE_TOP', 1); |
1057
|
|
|
|
1058
|
|
|
// Legend type stacked vertical or horizontal |
1059
|
|
|
self::setConfig('LEGEND_VERT', 0); |
1060
|
|
|
self::setConfig('LEGEND_HOR', 1); |
1061
|
|
|
|
1062
|
|
|
// Mark types for plot marks |
1063
|
|
|
self::setConfig('MARK_SQUARE', 1); |
1064
|
|
|
self::setConfig('MARK_UTRIANGLE', 2); |
1065
|
|
|
self::setConfig('MARK_DTRIANGLE', 3); |
1066
|
|
|
self::setConfig('MARK_DIAMOND', 4); |
1067
|
|
|
self::setConfig('MARK_CIRCLE', 5); |
1068
|
|
|
self::setConfig('MARK_FILLEDCIRCLE', 6); |
1069
|
|
|
self::setConfig('MARK_CROSS', 7); |
1070
|
|
|
self::setConfig('MARK_STAR', 8); |
1071
|
|
|
self::setConfig('MARK_X', 9); |
1072
|
|
|
self::setConfig('MARK_LEFTTRIANGLE', 10); |
1073
|
|
|
self::setConfig('MARK_RIGHTTRIANGLE', 11); |
1074
|
|
|
self::setConfig('MARK_FLASH', 12); |
1075
|
|
|
self::setConfig('MARK_IMG', 13); |
1076
|
|
|
self::setConfig('MARK_FLAG1', 14); |
1077
|
|
|
self::setConfig('MARK_FLAG2', 15); |
1078
|
|
|
self::setConfig('MARK_FLAG3', 16); |
1079
|
|
|
self::setConfig('MARK_FLAG4', 17); |
1080
|
|
|
|
1081
|
|
|
// Builtin images |
1082
|
|
|
|
1083
|
|
|
// Inline defines |
1084
|
|
|
self::setConfig('INLINE_YES', 1); |
1085
|
|
|
self::setConfig('INLINE_NO', 0); |
1086
|
|
|
|
1087
|
|
|
// Format for background images |
1088
|
|
|
self::setConfig('BGIMG_FILLPLOT', 1); |
1089
|
|
|
self::setConfig('BGIMG_FILLFRAME', 2); |
1090
|
|
|
self::setConfig('BGIMG_COPY', 3); |
1091
|
|
|
self::setConfig('BGIMG_CENTER', 4); |
1092
|
|
|
self::setConfig('BGIMG_FREE', 5); |
1093
|
|
|
|
1094
|
|
|
// Depth of objects |
1095
|
|
|
self::setConfig('DEPTH_BACK', 0); |
1096
|
|
|
self::setConfig('DEPTH_FRONT', 1); |
1097
|
|
|
|
1098
|
|
|
// Direction |
1099
|
|
|
self::setConfig('VERTICAL', 1); |
1100
|
|
|
self::setConfig('HORIZONTAL', 0); |
1101
|
|
|
|
1102
|
|
|
// Axis styles for scientific style axis |
1103
|
|
|
self::setConfig('AXSTYLE_SIMPLE', 1); |
1104
|
|
|
self::setConfig('AXSTYLE_BOXIN', 2); |
1105
|
|
|
self::setConfig('AXSTYLE_BOXOUT', 3); |
1106
|
|
|
self::setConfig('AXSTYLE_YBOXIN', 4); |
1107
|
|
|
self::setConfig('AXSTYLE_YBOXOUT', 5); |
1108
|
|
|
|
1109
|
|
|
// Style for title backgrounds |
1110
|
|
|
self::setConfig('TITLEBKG_STYLE1', 1); |
1111
|
|
|
self::setConfig('TITLEBKG_STYLE2', 2); |
1112
|
|
|
self::setConfig('TITLEBKG_STYLE3', 3); |
1113
|
|
|
self::setConfig('TITLEBKG_FRAME_NONE', 0); |
1114
|
|
|
self::setConfig('TITLEBKG_FRAME_FULL', 1); |
1115
|
|
|
self::setConfig('TITLEBKG_FRAME_BOTTOM', 2); |
1116
|
|
|
self::setConfig('TITLEBKG_FRAME_BEVEL', 3); |
1117
|
|
|
self::setConfig('TITLEBKG_FILLSTYLE_HSTRIPED', 1); |
1118
|
|
|
self::setConfig('TITLEBKG_FILLSTYLE_VSTRIPED', 2); |
1119
|
|
|
self::setConfig('TITLEBKG_FILLSTYLE_SOLID', 3); |
1120
|
|
|
|
1121
|
|
|
// Styles for axis labels background |
1122
|
|
|
self::setConfig('LABELBKG_NONE', 0); |
1123
|
|
|
self::setConfig('LABELBKG_XAXIS', 1); |
1124
|
|
|
self::setConfig('LABELBKG_YAXIS', 2); |
1125
|
|
|
self::setConfig('LABELBKG_XAXISFULL', 3); |
1126
|
|
|
self::setConfig('LABELBKG_YAXISFULL', 4); |
1127
|
|
|
self::setConfig('LABELBKG_XYFULL', 5); |
1128
|
|
|
self::setConfig('LABELBKG_XY', 6); |
1129
|
|
|
|
1130
|
|
|
// Style for background gradient fills |
1131
|
|
|
self::setConfig('BGRAD_FRAME', 1); |
1132
|
|
|
self::setConfig('BGRAD_MARGIN', 2); |
1133
|
|
|
self::setConfig('BGRAD_PLOT', 3); |
1134
|
|
|
|
1135
|
|
|
// Width of tab titles |
1136
|
|
|
self::setConfig('TABTITLE_WIDTHFIT', 0); |
1137
|
|
|
self::setConfig('TABTITLE_WIDTHFULL', -1); |
1138
|
|
|
|
1139
|
|
|
// Defines for 3D skew directions |
1140
|
|
|
self::setConfig('SKEW3D_UP', 0); |
1141
|
|
|
self::setConfig('SKEW3D_DOWN', 1); |
1142
|
|
|
self::setConfig('SKEW3D_LEFT', 2); |
1143
|
|
|
self::setConfig('SKEW3D_RIGHT', 3); |
1144
|
|
|
|
1145
|
|
|
// For internal use only |
1146
|
|
|
} |
1147
|
|
|
|
1148
|
|
|
public static function verifyCacheSettings() |
1149
|
|
|
{ |
1150
|
|
|
/* |
1151
|
|
|
* Directories for cache and font directory. |
1152
|
|
|
* Define these constants explicitly or read them from environment vars |
1153
|
|
|
* |
1154
|
|
|
* CACHE_DIR: |
1155
|
|
|
* The full absolute name of the directory to be used to store the |
1156
|
|
|
* cached image files. This directory will not be used if the USE_CACHE |
1157
|
|
|
* define (further down) is false. If you enable the cache please note that |
1158
|
|
|
* this directory MUST be readable and writable for the process running PHP. |
1159
|
|
|
* Must end with '/' |
1160
|
|
|
* |
1161
|
|
|
* TTF_DIR: |
1162
|
|
|
* Directory where TTF fonts can be found. Must end with '/' |
1163
|
|
|
* |
1164
|
|
|
* The default values used if these defines are left commented out are: |
1165
|
|
|
* |
1166
|
|
|
* UNIX: |
1167
|
|
|
* CACHE_DIR /tmp/jpgraph_cache/ |
1168
|
|
|
* TTF_DIR /usr/share/fonts/truetype/ |
1169
|
|
|
* MBTTF_DIR /usr/share/fonts/truetype/ |
1170
|
|
|
* |
1171
|
|
|
* WINDOWS: |
1172
|
|
|
* CACHE_DIR $SERVER_TEMP/jpgraph_cache/ |
1173
|
|
|
* TTF_DIR $SERVER_SYSTEMROOT/fonts/ |
1174
|
|
|
* MBTTF_DIR $SERVER_SYSTEMROOT/fonts/ |
1175
|
|
|
* |
1176
|
|
|
*/ |
1177
|
|
|
|
1178
|
|
|
// Define these constants explicitly |
1179
|
|
|
// define('CACHE_DIR','/tmp/jpgraph_cache/'); |
1180
|
|
|
// define('TTF_DIR','/usr/share/fonts/TrueType/'); |
1181
|
|
|
// define('MBTTF_DIR','/usr/share/fonts/TrueType/'); |
1182
|
|
|
// |
1183
|
|
|
// Or read them from environment variables |
1184
|
|
|
if (getenv('JPGRAPH_CACHE_DIR')) { |
1185
|
|
|
self::setConfig('CACHE_DIR', getenv('JPGRAPH_CACHE_DIR')); |
1186
|
|
|
} |
1187
|
|
|
if (getenv('JPGRAPH_TTF_DIR')) { |
1188
|
|
|
self::setConfig('TTF_DIR', getenv('JPGRAPH_TTF_DIR')); |
1189
|
|
|
} |
1190
|
|
|
if (getenv('JPGRAPH_MBTTF_DIR')) { |
1191
|
|
|
self::setConfig('MBTTF_DIR', getenv('JPGRAPH_MBTTF_DIR')); |
1192
|
|
|
} |
1193
|
|
|
|
1194
|
|
|
/* |
1195
|
|
|
* Cache directory specification for use with CSIM graphs that are |
1196
|
|
|
* // using the cache. |
1197
|
|
|
* // The directory must be the filesysystem name as seen by PHP |
1198
|
|
|
* // and the 'http' version must be the same directory but as |
1199
|
|
|
* // seen by the HTTP server relative to the 'htdocs' ddirectory. |
1200
|
|
|
* // If a relative path is specified it is taken to be relative from where |
1201
|
|
|
* // the image script is executed. |
1202
|
|
|
* // Note: The default setting is to create a subdirectory in the |
1203
|
|
|
* // directory from where the image script is executed and store all files |
1204
|
|
|
* // there. As ususal this directory must be writeable by the PHP process. |
1205
|
|
|
*/ |
1206
|
|
|
//self::setConfig('CSIMCACHE_DIR', 'csimcache/'); |
1207
|
|
|
//self::setConfig('CSIMCACHE_HTTP_DIR', 'csimcache/'); |
1208
|
|
|
|
1209
|
|
|
if (self::getConfig('USE_CACHE')) { |
1210
|
|
|
if (!defined('CACHE_DIR')) { |
1211
|
|
|
if (strstr(PHP_OS, 'WIN')) { |
1212
|
|
|
if (empty($_SERVER['TEMP'])) { |
1213
|
|
|
$t = new ErrMsgText(); |
1214
|
|
|
$msg = $t->Get(11, $file, $lineno); |
|
|
|
|
1215
|
|
|
die($msg); |
|
|
|
|
1216
|
|
|
} |
1217
|
|
|
self::setConfig('CACHE_DIR', $_SERVER['TEMP'] . '/'); |
1218
|
|
|
} else { |
1219
|
|
|
self::setConfig('CACHE_DIR', '/tmp/jpgraph_cache/'); |
1220
|
|
|
} |
1221
|
|
|
} |
1222
|
|
|
} else { |
1223
|
|
|
self::setConfig('CACHE_DIR', ''); |
1224
|
|
|
} |
1225
|
|
|
} |
1226
|
|
|
|
1227
|
|
|
public static function verifyTTFSettings() |
1228
|
|
|
{ |
1229
|
|
|
//self::setConfig('CSIMCACHE_DIR','csimcache/'); |
1230
|
|
|
//self::setConfig('CSIMCACHE_HTTP_DIR','csimcache/'); |
1231
|
|
|
/* |
1232
|
|
|
* Setup path for TTF fonts |
1233
|
|
|
*/ |
1234
|
|
|
if (defined('TTF_DIR')) { |
1235
|
|
|
return; |
1236
|
|
|
} |
1237
|
|
|
|
1238
|
|
|
if (strstr(PHP_OS, 'WIN')) { |
1239
|
|
|
if (!defined('SYSTEMROOT')) { |
1240
|
|
|
$t = new ErrMsgText(); |
1241
|
|
|
$msg = $t->Get(12, $file, $lineno); |
|
|
|
|
1242
|
|
|
die($msg); |
|
|
|
|
1243
|
|
|
} |
1244
|
|
|
self::setConfig('TTF_DIR', SYSTEMROOT . '/fonts/'); |
1245
|
|
|
} else { |
1246
|
|
|
self::setConfig('TTF_DIR', '/usr/share/fonts/truetype/'); |
1247
|
|
|
} |
1248
|
|
|
} |
1249
|
|
|
|
1250
|
|
|
public static function verifyMBTTFSettings() |
1251
|
|
|
{ |
1252
|
|
|
/* |
1253
|
|
|
* Setup path for MultiByte TTF fonts (japanese, chinese etc.) |
1254
|
|
|
*/ |
1255
|
|
|
if (defined('MBTTF_DIR')) { |
1256
|
|
|
return; |
1257
|
|
|
} |
1258
|
|
|
|
1259
|
|
|
if (strstr(PHP_OS, 'WIN')) { |
1260
|
|
|
if (!defined('SYSTEMROOT')) { |
1261
|
|
|
$t = new ErrMsgText(); |
1262
|
|
|
$msg = $t->Get(12, $file, $lineno); |
|
|
|
|
1263
|
|
|
die($msg); |
|
|
|
|
1264
|
|
|
} |
1265
|
|
|
self::setConfig('MBTTF_DIR', SYSTEMROOT . '/fonts/'); |
1266
|
|
|
} else { |
1267
|
|
|
self::setConfig('MBTTF_DIR', '/usr/share/fonts/truetype/'); |
1268
|
|
|
} |
1269
|
|
|
} |
1270
|
|
|
|
1271
|
|
|
/** |
1272
|
|
|
* Traverse format related constants. |
1273
|
|
|
* self::heck(et them to defaults otherwise. |
1274
|
|
|
*/ |
1275
|
|
|
public static function verifyFormatSettings() |
1276
|
|
|
{ |
1277
|
|
|
// Deafult graphic format set to 'auto' which will automatically |
1278
|
|
|
// choose the best available format in the order png,gif,jpeg |
1279
|
|
|
// (The supported format depends on what your PHP installation supports) |
1280
|
|
|
self::setConfig('DEFAULT_GFORMAT', 'auto'); |
1281
|
|
|
// The builtin GD function imagettfbbox() fuction which calculates the bounding box for |
1282
|
|
|
// text using TTF fonts is buggy. By setting this define to true the library |
1283
|
|
|
// uses its own compensation for this bug. However this will give a |
1284
|
|
|
// slightly different visual apparance than not using this compensation. |
1285
|
|
|
// Enabling this compensation will in general give text a bit more space to more |
1286
|
|
|
// truly reflect the actual bounding box which is a bit larger than what the |
1287
|
|
|
// GD function thinks. |
1288
|
|
|
self::setConfig('USE_LIBRARY_IMAGETTFBBOX', true); |
1289
|
|
|
|
1290
|
|
|
// Maximum size for Automatic Gantt chart |
1291
|
|
|
self::setConfig('MAX_GANTTIMG_SIZE_W', 8000); |
1292
|
|
|
self::setConfig('MAX_GANTTIMG_SIZE_H', 5000); |
1293
|
|
|
} |
1294
|
|
|
} |
1295
|
|
|
|
1296
|
|
|
Configs::setGeneralConfigs(); |
1297
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.