-
Notifications
You must be signed in to change notification settings - Fork 0
/
php.json
439 lines (439 loc) · 13.3 KB
/
php.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
{
"ZebraForm radio buttons": {
"prefix": "s-zf-radio",
"body": [
"\\$form->add('label', '$label_name', '$control_name', \\$translation->getValue('$translation'));",
"\\$obj = \\$form->add('radios', '$control_name', $options);",
"\\$obj->set_attributes(array(",
"\t'class' => 'input-field control'",
"));"
],
"description": "Create ZebraForm radio buttons"
},
"ZebraForm checkbox": {
"prefix": "s-zf-checkbox",
"body": [
"\\$obj = \\$form->add('checkbox', '$control_name', '$value');"
],
"description": "Create ZebraForm checkbox control"
},
"ZebraForm checkbox2": {
"prefix": "s-zf-checkbox2",
"body": [
"\\$obj = \\$form->add('checkbox2', '${1:control_name}', '${2:value}', \\$translation->getValue('${3:translation}'));"
],
"description": "Create ZebraForm checkbox2 control"
},
"ZebraForm date": {
"prefix": "s-zf-date",
"body": [
"\\$form->add('label', '$label_name', '$control_name', \\$translation->getValue('$translation'));",
"\\$obj = \\$form->add('date', '$control_name', date('Ymd'));",
"\\$obj->format('Ymd');",
"\\$obj->set_rule(array(",
"\t'date' => array('error', \\$translation->getValue('errDate')),",
"));"
],
"description": "Create ZebraForm date control"
},
"ZebraForm text": {
"prefix": "s-zf-text",
"body": [
"\\$form->add('label', '$label_name', '$control_name', \\$translation->getValue('$translation'));",
"\\$obj = \\$form->add('text', '$control_name');",
"\\$obj->set_attributes(array(",
"\t'class' => 'input-field control form-control',",
"));"
],
"description": "Create ZebraForm text control"
},
"ZebraForm select": {
"prefix": "s-zf-select",
"body": [
"\\$form->add('label', '$label', '$control_name', \\$translation->getValue('$translation'));",
"\\$obj = \\$form->add('select', '$control_name');",
"\\$obj->add_options($options);",
"\\$obj->set_attributes(array(",
"\t'class' => 'input-field control form-control',",
"));"
],
"description": "Create ZebraForm select control"
},
"ZebraForm price": {
"prefix": "s-zf-price",
"body": [
"\\$form->add('label', 'label$control_name', '$control_name', \\$translation->getValue('$translation'));",
"\\$obj = \\$form->add('price', '$control_name');",
"\\$obj->set_rule(array(",
"\t'required' => array('error', 'Prys is verpligtend!'),",
"\t'length' => array(1,10,'error','Value must have between 1 and 7 characters!'),",
"\t'regexp' => array('^(?!0\\.00)\\d{1,}(.\\d{1,})*(\\.\\d\\d)?$','error','Mag nie nul wees nie'),",
"));",
"\\$obj->set_attributes(array(",
"\t'class' => 'input-field control form-control'",
"));"
],
"description": "Create ZebraForm select control"
},
"ZebraForm button": {
"prefix": "s-zf-button",
"body": [
"\\$obj = \\$form->add('button', '${1:control_name}', '<span class=\"fa fa-${2:icon}\"></span> '.\\$translation->getValue('${3:translation}'));",
"\\$obj->set_attributes(array(",
"\t'class' => 'btn btn-${4|success,warning,info,danger|}',",
"\t'onclick' => '$function_name',",
"));"
],
"description": "Create ZebraForm button control"
},
"ZebraForm spam filter": {
"prefix": "s-zf-spam-filter",
"body": [
"\\$obj->disable_spam_filter();"
],
"description": "Disable ZebraForm's spam filter"
},
"ZebraForm case": {
"prefix": "s-zf-case",
"body": [
"\\$obj->change_case('upper');"
],
"description": "Change case of ZebraForm control"
},
"ZebraForm set attributes": {
"prefix": "s-zf-attributes",
"body": [
"\\$obj->set_attributes(array(",
"\t$0",
"));"
],
"description": "ZebraForm set attributes"
},
"ZebraForm autofocus attribute": {
"prefix": "s-zf-autofocus",
"body": [
"'autofocus' => 'autofocus',"
],
"description": "ZebraForm autofocus attribute"
},
"ZebraForm reaonly attribute": {
"prefix": "s-zf-readonly",
"body": [
"'readonly' => 'readonly',"
],
"description": "ZebraForm readonly attribute"
},
"ZebraForm form control attribute": {
"prefix": "s-zf-form-control",
"body": [
"'class' => 'input-field control form-control',"
],
"description": "ZebraForm form control attribute"
},
"ZebraForm onChange attribute": {
"prefix": "s-zf-nchange",
"body": [
"'onchange' => '$function_name',"
],
"description": "ZebraFrom onChange attribute"
},
"ZebraForm onClick attribute": {
"prefix": "s-zf-onclick",
"body": [
"'onclick' => '$function_name',"
],
"description": "ZebraFrom onClick attribute"
},
"ZebraForm checked attribute": {
"prefix": "s-zf-checked",
"body": [
"'checked' => '${1|true,false|}',"
],
"description": "ZebraFrom checked attribute"
},
"ZebraForm set rule": {
"prefix": "s-zf-rule",
"body": [
"\\$obj->set_rule(array(",
"\t$0",
"));"
],
"description": "ZebraForm setRule attribute"
},
"ZebraForm number rule": {
"prefix": "s-zf-number",
"body": [
"'number' => array('', 'error', \\$translation->getValue('errNumeries')),"
],
"description": "ZebraForm number rule"
},
"ZebraForm required rule": {
"prefix": "s-zf-required",
"body": [
"'required' => array('error', \\$translation->getValue('errRequired')),"
],
"description": "ZebraForm required rule"
},
"ZebraForm length rule": {
"prefix": "s-zf-length",
"body": [
"'length' => array($start_length, $end_lenght, 'error', \\$translation->getValue('errLength')),"
],
"description": "ZebraFrom length rule"
},
"ZebraForm dependency rule": {
"prefix": "s-zf-dependency",
"body": [
"'dependencies' => array(array('$control_name' => $trigger_val), '$calback_name, $calback_param'),"
],
"description": "ZebraFrom dependency rule"
},
"Translation": {
"prefix": "s-lang",
"body": [
"\\$translation->getValue('$translation'));"
],
"description": "Create Translation variable"
},
"Toegang": {
"prefix": "s-access",
"body": [
"require_once(\\$_SERVER['DOCUMENT_ROOT'] .'/nwk/services/TOEGANG001_SERVICE.class.php');",
"\\$toegang_$keyword = \\$TOEGANG->het_funksie_toegang(\"${TM_FILENAME}\",\"$keyword\");"
],
"description": "Toegangsbeheer"
},
"PHP Switch": {
"prefix": "s-switch",
"body": [
"\\$action = (!empty(\\$_REQUEST['action']))?\\$_REQUEST['action']:'';",
"switch (\\$action) {",
" case 'function_name':",
" function_name();",
" break;",
"",
" default:",
" break;",
"}"
],
"description": "JSON switch"
},
"Template": {
"prefix": "s-template",
"body": [
"require_once(\\$_SERVER['DOCUMENT_ROOT'] .'/nwk/Language/Language.class.php');",
"\\$translation = Language::start();",
"echo (isset(\\$zf_error) ? \\$zf_error : (isset(\\$error) ? \\$error : ''));",
"?>",
"<div class=\"container-fluid\">",
"\t<div class=\"row\">",
"\t\t<i style=\"float: right; color: #AFAFAF\" class=\"fa fa-info-circle\" title=\"",
"PHP:",
"$php_programs",
"",
"NATURAL:",
"$natural_programs",
"",
"WSDL:",
"$wsdl\"",
"\t\t></i>",
"\t\t<fieldset>",
"\t\t\t<legend><?php echo \\$translation->getValue('$translation');?></legend>",
"\t\t\t<div class=\"row\">",
"\t\t\t\t<div class=\"col-sm-2 col-md-2 col-lg-2\">",
"\t\t\t\t\t<?php echo $label_name;?>",
"\t\t\t\t</div>",
"\t\t\t\t<div class=\"col-sm-3 col-md-3 col-lg-3\">",
"\t\t\t\t\t<?php echo $control_name;?>",
"\t\t\t\t</div>",
"\t\t\t</div>",
"\t\t</fieldset>",
"\t</div>",
"</div>"
],
"description": "Create template for ZebraForm"
},
"Class": {
"prefix": "s-create-class",
"body": [
"class $class_name {",
"\tprivate \\$fout, \\$data, \\$translation;",
"",
"\tfunction __construct() {",
"\t\trequire_once(\\$_SERVER['DOCUMENT_ROOT'] .'/nwk/Language/Language.class.php');",
"\t\t\\$this->translation = Language::start();",
"",
"\t\t\\$wsdl = '$wsdl';",
"\t\t\\$wsdl_pad = 'http://'.\\$_SERVER['HTTP_HOST'].':10010/wsstack/services/'.\\$wsdl.'.wsdl?';",
"",
"\t\trequire_once(\\$_SERVER['DOCUMENT_ROOT'].'/nwk/config.php');",
"\t\t\\$this->client = new client(\\$wsdl_pad, \\$wsdl);",
"",
"\t\t\\$this->data = array();",
"\t\t\\$this->data['_SOEK_VELD'] = '';",
"\t\t\\$this->data['_SOEK_WAARDE'] = '';",
"\t\t\\$this->data['_FOUT'] = '';",
"\t\t\\$this->data['_VELD'] = '';",
"\t\t\\$this->data['_S'] = '';",
"",
"\t\t\\$this->resetFout();",
"\t}",
"",
"\t/**",
"\t * Herstel fout-veranderlike na null",
"\t */",
"\tprivate function resetFout() {",
"\t\t\\$this->fout = null;",
"\t}",
"",
"\t/**",
"\t * Kry die fout-veranderlike",
"\t * ",
"\t * @return string",
"\t */",
"\tpublic function kryFout() {",
"\t\treturn \\$this->fout;",
"\t}",
"",
"\t/**",
"\t * Roep 'n Natural program",
"\t * ",
"\t * @param string \\$program die program om te roep",
"\t * @return stdClass",
"\t * ",
"\t */",
"\tpublic function roepNat(\\$program) {",
"\t\t\\$this->resetFout();",
"",
"\t\ttry {",
"\t\t\t\\$resultaat = \\$this->client->callFunction(\\$program, \\$this->data);",
"",
"\t\t\tif (!empty(\\$resultaat->ErrorValue)) {",
"\t\t\t\tthrow new NaturalException('NOTY', \\$resultaat->ErrorValue);",
"\t\t\t} else if (!empty(\\$resultaat->faultstring)) {",
"\t\t\t\tthrow new NaturalException('NOTY', \\$resultaat->faultstring);",
"\t\t\t} else if (\\$resultaat->_S == 'N' || !empty(\\$resultaat->_FOUT)) {",
"\t\t\t\t\\$fout = !empty(\\$resultaat->_FOUT) ? \\$resultaat->_FOUT : 'errOnverwagteFout';",
"\t\t\t\t\\$veld = !empty(\\$resultaat->_VELD) ? \\$resultaat->_VELD : 'NOTY';",
"\t\t\t\tthrow new NaturalException(\\$veld, \\$fout);",
"\t\t\t} ",
"\t\t} catch (NaturalException \\$e) {",
"\t\t\t\\$this->fout['BOODSKAP'] = \\$e->getVeld().': '.\\$this->translation->getValue(\\$e->getFout()).' ('.\\$e->getFile().' - '.\\$e->getLine().')';",
"\t\t\t\\$this->fout['SLEUTEL'] = \\$e->getFout();",
"\t\t} finally {",
"\t\t\treturn \\$resultaat;",
"\t\t}",
"\t}",
"}"
],
"description": "Create class"
},
"ZebraForm attach tip": {
"prefix": "s-zf-attach-tip",
"body": [
"\\$form->fout('${1:field}', \\$translation->getValue('${2:translation}'), '${3:template}');"
],
"description": "ZebraForm attach tip on field"
},
"ZebraForm next page": {
"prefix": "s-zf-next-page",
"body": [
"\\$parms = array();",
"\\$form->next_page('${1:url_of_page}',\\$parms);"
],
"description": "ZebraForm redirect to new page with parameters passed with GET"
},
"Show Noty wrapper": {
"prefix": "s-noty-wrapper",
"body": [
"function $function_name(\\$$message, \\$$type, \\$$timeout, \\$$exit = false) {",
"\tglobal \\$form;",
"",
"\t\\$noty = [];",
"\t\\$noty['message'] = \\$$message;",
"\t\\$noty['position'] = 'top';",
"\t\\$noty['timeout'] = \\$$timeout;",
"\t\\$noty['modal'] = true;",
"\t\\$noty['type'] = \\$$type;",
"\t\\$form->show_noty(\\$noty);",
"",
"\tif (\\$$exit) {",
"\t\texit;",
"\t}",
"}"
],
"description": "A wrapper for the show_noty-function"
},
"Natural call": {
"prefix": "s-natural-call",
"body": [
"try {",
"\t\\$wsdl = \"WSDL\";",
"\t\\$program = \"NAT\";",
"\t\\$wsdl_pad = 'http://'.\\$_SERVER['HTTP_HOST'].':10010/wsstack/services/'.\\$wsdl.'.wsdl?';",
"",
"\trequire_once(\\$_SERVER['DOCUMENT_ROOT'].'/nwk/config.php');",
"\t\\$this->client = new client(\\$wsdl_pad, \\$wsdl);",
"",
"\t\\$data = [];",
"\t\\$data['_FOUT'] = '';",
"\t\\$data['_VELD'] = '';",
"\t\\$data['_EVENT'] = '';",
"\t\\$data['_S'] = '';",
"",
"\t\\$resultaat = \\$client->callFunction(\\$program, \\$data);",
"\t\\$veld = (!empty(\\$resultaat->_VELD)) ? \\$resultaat->_VELD : '_NOTY';",
"",
"\t//\\$DEBUG->debug(\\$resultaat,true);",
"",
"\tif (!empty(\\$resultaat->ErrorValue)) {",
"\t\tthrow new NaturalException(\\$veld, \\$resultaat->ErrorValue);",
"\t} else if (!empty(\\$resultaat->faultstring)) {",
"\t\tthrow new NaturalException(\\$veld, \\$resultaat->faultstring);",
"\t} else if ((!empty(\\$resultaat->_S) && \\$resultaat->_S == 'N') || !empty(\\$resultaat->_FOUT)) {",
"\t\t\\$fout = !empty(\\$resultaat->_FOUT) ? \\$translation->getValue(\\$resultaat->_FOUT) : \\$translation->getValue('errOnverwagteFout');",
"\t\tthrow new NaturalException(\\$veld, \\$fout);",
"\t} else {",
"",
"\t}",
"} catch (NaturalException \\$e) {",
"\t\\$error = \\$e->getVeld().': '.\\$e->getFout().' ('.\\$e->getFile().' - '. \\$e->getLine().')';",
"}"
],
"description": "Natural call with error handling"
},
"ZebraForm Date Callback": {
"prefix": "s-zf-date-onchange",
"body": [
"\\$form->clientside_validation(array(",
"\t'on_ready' => 'callback',",
"));"
],
"description": "Paired with JS snippet. onChange Date Callback for ZebraForm"
},
"Include AIO Service": {
"prefix": "s-aio-include",
"body": [
"require_once \\$_SERVER['DOCUMENT_ROOT'] . '/SERVICES/ALLINONE/srv_aio_001_S_srv.php';"
],
"description": "Include AIO Service in PHP"
},
"Debug with Print-R": {
"prefix": "s-debug",
"body": [
"echo '<pre>';",
"print_r($${1:result});",
"echo '</pre>';",
"die;"
],
"description": "Debugs a variable with Print-R"
},
"Debug with Service": {
"prefix": "s-debug-service",
"body": [
"require_once(\\$_SERVER['DOCUMENT_ROOT'] .'/nwk/debug.php');",
"\\$DEBUG->debug(\\$${1:var_to_debug}, ${2|true,false|});"
],
"description": "Debugs a variable and optionally exits the script"
}
}