-
-
Notifications
You must be signed in to change notification settings - Fork 173
/
a_Get.php
4513 lines (4340 loc) · 143 KB
/
a_Get.php
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
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.0
@created 30th April, 2015
@package Component Builder
@subpackage compiler.php
@author Llewellyn van der Merwe <http://www.vdm.io>
@my wife Roline van der Merwe <http://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Get class as the main compilers class
*/
class Get
{
/**
* The Params
*
* @var object
*/
public $params;
/**
* The placeholders
*
* @var array
*/
public $placeholders = array();
/**
* The Compiler Path
*
* @var object
*/
public $compilerPath;
/**
* Switch to add custom code placeholders
*
* @var bool
*/
public $addPlaceholders = false;
/**
* The Component data
*
* @var object
*/
public $componentData;
/***********************************************************************************************
* The custom script placeholders - we use the (xxx) to avoid detection it should be (***)
* ##################################---> PHP/JS <---####################################
*
* New Insert Code = /xxx[INSERT<>$$$$]xxx/ /xxx[/INSERT<>$$$$]xxx/
* New Replace Code = /xxx[REPLACE<>$$$$]xxx/ /xxx[/REPLACE<>$$$$]xxx/
*
* //////////////////////////////// when JCB adds it back //////////////////////////////////
* JCB Add Inserted Code = /xxx[INSERTED$$$$]xxx//x23x/ /xxx[/INSERTED$$$$]xxx/
* JCB Add Replaced Code = /xxx[REPLACED$$$$]xxx//x25x/ /xxx[/REPLACED$$$$]xxx/
*
* /////////////////////////////// changeing existing custom code /////////////////////////
* Update Inserted Code = /xxx[INSERTED<>$$$$]xxx//x23x/ /xxx[/INSERTED<>$$$$]xxx/
* Update Replaced Code = /xxx[REPLACED<>$$$$]xxx//x25x/ /xxx[/REPLACED<>$$$$]xxx/
*
* The custom script placeholders - we use the (==) to avoid detection it should be (--)
* ###################################---> HTML <---#####################################
*
* New Insert Code = <!==[INSERT<>$$$$]==> <!==[/INSERT<>$$$$]==>
* New Replace Code = <!==[REPLACE<>$$$$]==> <!==[/REPLACE<>$$$$]==>
*
* ///////////////////////////////// when JCB adds it back ///////////////////////////////
* JCB Add Inserted Code = <!==[INSERTED$$$$]==><!==23==> <!==[/INSERTED$$$$]==>
* JCB Add Replaced Code = <!==[REPLACED$$$$]==><!==25==> <!==[/REPLACED$$$$]==>
*
* //////////////////////////// changeing existing custom code ///////////////////////////
* Update Inserted Code = <!==[INSERTED<>$$$$]==><!==23==> <!==[/INSERTED<>$$$$]==>
* Update Replaced Code = <!==[REPLACED<>$$$$]==><!==25==> <!==[/REPLACED<>$$$$]==>
*
* ////////23 is the ID of the code in the system don't change it!!!!!!!!!!!!!!!!!!!!!!!!!!
*
* @var array
***********************************************************************************************/
protected $customCodePlaceholders = array(
1 => 'REPLACE<>$$$$]',
2 => 'INSERT<>$$$$]',
3 => 'REPLACED<>$$$$]',
4 => 'INSERTED<>$$$$]'
);
/**
* The custom code to be added
*
* @var array
*/
public $customCode;
/**
* The custom code to be added
*
* @var array
*/
protected $customCodeData = array();
/**
* The function name memory ids
*
* @var array
*/
public $functionNameMemory = array();
/**
* The custom code for local memory
*
* @var array
*/
public $customCodeMemory = array();
/**
* The custom code in local files that aready exist in system
*
* @var array
*/
protected $existingCustomCode = array();
/**
* The custom code in local files this are new
*
* @var array
*/
protected $newCustomCode = array();
/**
* The index of code already loaded
*
* @var array
*/
protected $codeAreadyDone = array();
/*
* The line numbers Switch
*
* @var boolean
*/
public $debugLinenr = false;
/*
* The percentage when a language should be added
*
* @var boolean
*/
public $percentageLanguageAdd = 0;
/**
* The Placholder Language prefix
*
* @var string
*/
public $langPrefix;
/**
* The Language content
*
* @var array
*/
public $langContent = array();
/**
* The Languages bucket
*
* @var array
*/
public $languages = array('en-GB' => array());
/**
* The Multi Languages bucket
*
* @var array
*/
public $multiLangString = array();
/**
* The new lang to add
*
* @var array
*/
protected $newLangStrings = array();
/**
* The existing lang to update
*
* @var array
*/
protected $existingLangStrings = array();
/**
* The Component Code Name
*
* @var string
*/
public $componentCodeName;
/**
* The Component ID
*
* @var int
*/
public $componentID;
/**
* The current user
*
* @var array
*/
public $user;
/**
* The database object
*
* @var array
*/
public $db;
/**
* The Component version
*
* @var string
*/
public $component_version;
/**
* The UIKIT Switch
*
* @var boolean
*/
public $uikit = false;
/**
* The UIKIT component checker
*
* @var array
*/
public $uikitComp = array();
/**
* The FOOTABLE Switch
*
* @var boolean
*/
public $footable = false;
/**
* The FOOTABLE Version
*
* @var int
*/
public $footableVersion;
/**
* The Google Chart Switch per view
*
* @var array
*/
public $googleChart = array();
/**
* The Google Chart Switch
*
* @var boolean
*/
public $googlechart = false;
/**
* The Import & Export Switch
*
* @var boolean
*/
public $addEximport = false;
/**
* The Tag & History Switch
*
* @var boolean
*/
public $setTagHistory = false;
/**
* The site edit views
*
* @var array
*/
public $siteEditView = array();
/**
* The Language target
*
* @var string
*/
public $lang = 'admin';
/**
* The Build target Switch
*
* @var string
*/
public $target;
/**
* The unique codes
*
* @var array
*/
public $uniquecodes = array();
/**
* The unique keys
*
* @var array
*/
public $uniquekeys = array();
/**
* The Ad contributors Switch
*
* @var boolean
*/
public $addContributors = false;
/**
* The Custom Script Builder
*
* @var array
*/
public $customScriptBuilder = array();
/**
* The Footable Script Builder
*
* @var array
*/
public $footableScripts = array();
/**
* The pathe to the bom file to be used
*
* @var string
*/
public $bomPath;
/**
* The SQL Tweak of admin views
*
* @var array
*/
public $sqlTweak = array();
/**
* The admin views data array
*
* @var array
*/
private $_adminViewData = array();
/**
* The field data array
*
* @var array
*/
private $_fieldData = array();
/**
* The linked admin view tabs
*
* @var array
*/
public $linkedAdminViews = array();
/**
* The Add Ajax Switch
*
* @var boolean
*/
public $addAjax = false;
/**
* The Add Site Ajax Switch
*
* @var boolean
*/
public $addSiteAjax = false;
/**
* The get Module Script Switch
*
* @var array
*/
public $getModule = array();
/**
* The template data
*
* @var array
*/
public $templateData = array();
/**
* The layout data
*
* @var array
*/
public $layoutData = array();
/**
* The Advanced Encryption Switch
*
* @var boolean
*/
public $advancedEncryption = false;
/**
* The Basic Encryption Switch
*
* @var boolean
*/
public $basicEncryption = false;
/**
* The Custom field Switch per view
*
* @var array
*/
public $customFieldScript = array();
/**
* The site main get
*
* @var array
*/
public $siteMainGet = array();
/**
* The site dynamic get
*
* @var array
*/
public $siteDynamicGet = array();
/**
* The get AS lookup
*
* @var array
*/
public $getAsLookup = array();
/**
* The site fields
*
* @var array
*/
public $siteFields = array();
/**
* The add SQL
*
* @var array
*/
public $addSQL = array();
/**
* The update SQL
*
* @var array
*/
public $updateSQL = array();
/***
* Constructor
*/
public function __construct($config = array ())
{
if (isset($config) && count($config))
{
// Set the params
$this->params = JComponentHelper::getParams('com_componentbuilder');
// load the compiler path
$this->compilerPath = $this->params->get('compiler_folder_path', JPATH_COMPONENT_ADMINISTRATOR.'/compiler');
// set the component ID
$this->componentID = (int) $config['componentId'];
// set this components code name
if ($name_code = ComponentbuilderHelper::getVar('joomla_component', $this->componentID, 'id', 'name_code'))
{
// set lang prefix
$this->langPrefix = 'COM_'.ComponentbuilderHelper::safeString($name_code,'U');
// set component code name
$this->componentCodeName = ComponentbuilderHelper::safeString($name_code);
// set if placeholders should be added to customcode
$global = ((int) ComponentbuilderHelper::getVar('joomla_component', $this->componentID, 'id', 'add_placeholders') == 1) ? true:false;
$this->addPlaceholders = ((int) $config['addPlaceholders'] == 0) ? false : (((int) $config['addPlaceholders'] == 1) ? true : $global);
// set if line numbers should be added to comments
$global = ((int) ComponentbuilderHelper::getVar('joomla_component', $this->componentID, 'id', 'debug_linenr') == 1) ? true:false;
$this->debugLinenr = ((int) $config['debugLinenr'] == 0) ? false : (((int) $config['debugLinenr'] == 1) ? true : $global);
// set the current user
$this->user = JFactory::getUser();
// Get a db connection.
$this->db = JFactory::getDbo();
// check if this component is install on the current website
if ($paths = $this->getLocalInstallPaths())
{
// start Automatic import of custom code
$today = JFactory::getDate()->toSql();
// get the custom code from installed files
$this->customCodeFactory($paths, $today);
}
// get the component data
$this->componentData = $this->getComponentData();
// make sure we have a version
if (strpos($this->componentData->component_version, '.') === FALSE)
{
$this->componentData->component_version = '1.0.0';
}
// update the version
if (!isset($this->componentData->old_component_version)
&& (ComponentbuilderHelper::checkArray($this->addSQL) || ComponentbuilderHelper::checkArray($this->updateSQL)))
{
// set the new version
$version = (array) explode('.', $this->componentData->component_version);
// get last key
end($version);
$key = key($version);
// just increment the last
$version[$key]++;
// set the old version
$this->componentData->old_component_version = $this->componentData->component_version;
// set the new version, and set update switch
$this->componentData->component_version = implode('.', $version);
}
// set the percentage when a language can be added
$this->percentageLanguageAdd = (int) $this->params->get('percentagelanguageadd', 50);
return true;
}
}
return false;
}
/**
* Set the line number in comments
*
* @param int $nr The line number
*
* @return void
*
*/
private function setLine($nr)
{
if ($this->debugLinenr)
{
return ' [Get '.$nr.']';
}
return '';
}
/**
* get all Component Data
*
* @param int $id The component ID
*
* @return oject The component data
*
*/
public function getComponentData()
{
// Create a new query object.
$query = $this->db->getQuery(true);
$query->select('a.*');
$query->from('#__componentbuilder_joomla_component AS a');
$query->where($this->db->quoteName('a.id') . ' = '. (int) $this->componentID);
// Reset the query using our newly populated query object.
$this->db->setQuery($query);
// Load the results as a list of stdClass objects
$component = $this->db->loadObject();
// set component place holders
$this->placeholders['###component###'] = ComponentbuilderHelper::safeString($component->name_code);
$this->placeholders['###Component###'] = ComponentbuilderHelper::safeString($component->name_code, 'F');
$this->placeholders['###COMPONENT###'] = ComponentbuilderHelper::safeString($component->name_code, 'U');
$this->placeholders['[[[component]]]'] = $this->placeholders['###component###'];
$this->placeholders['[[[Component]]]'] = $this->placeholders['###Component###'];
$this->placeholders['[[[COMPONENT]]]'] = $this->placeholders['###COMPONENT###'];
// set component sales name
$component->sales_name = ComponentbuilderHelper::safeString($component->system_name);
// ensure version naming is correct
$this->component_version = preg_replace('/[^0-9.]+/', '', $component->component_version);
// ser the addfolders data
$addfolders = json_decode($component->addfolders,true);
if (ComponentbuilderHelper::checkArray($addfolders))
{
foreach ($addfolders as $option => $values)
{
foreach ($values as $nr => $value)
{
$component->folders[$nr][$option] = $value;
}
}
unset($component->addfolders);
}
// ser the addfiles data
$addfiles = json_decode($component->addfiles,true);
if (ComponentbuilderHelper::checkArray($addfiles))
{
foreach ($addfiles as $option => $values)
{
foreach ($values as $nr => $value)
{
$component->files[$nr][$option] = $value;
}
}
unset($component->addfiles);
}
// set the uikit switch
if ($component->adduikit)
{
$this->uikit = true;
}
// set the footable switch
if ($component->addfootable)
{
$this->footable = true;
// add the version
$this->footableVersion = (1 == $component->addfootable || 2 == $component->addfootable) ? 2 : $component->addfootable;
}
// ser the addcustommenu data
$addcustommenus = json_decode($component->addcustommenus,true);
if (ComponentbuilderHelper::checkArray($addcustommenus))
{
foreach ($addcustommenus as $option => $values)
{
foreach ($values as $nr => $value)
{
$component->custommenus[$nr][$option] = $value;
}
}
unset($component->addcustommenus);
}
// tweak the mysql dump settings if needed
$sql_tweak = json_decode($component->sql_tweak,true);
if (ComponentbuilderHelper::checkArray($sql_tweak))
{
$component->sql_tweak = array();
foreach ($sql_tweak as $option => $values)
{
foreach ($values as $nr => $value)
{
if ((string)(int)$value == $value)
{
$component->sql_tweak[$nr][$option] = (int) $value;
}
else
{
$component->sql_tweak[$nr][$option] = $value;
}
}
}
// build the tweak settings
$this->setSqlTweaking($component->sql_tweak);
unset($component->sql_tweak);
}
// set the admin_view data
$admin_views = json_decode($component->addadmin_views,true);
if (ComponentbuilderHelper::checkArray($admin_views))
{
foreach ($admin_views as $option => $values)
{
foreach ($values as $nr => $value)
{
if ((string)(int)$value == $value)
{
$component->admin_views[$nr][$option] = (int) $value;
}
else
{
$component->admin_views[$nr][$option] = $value;
}
}
}
unset($component->addadmin_views);
// sort the views acording to order
usort($component->admin_views, function($a, $b)
{
if ($a['order'] != 0 && $b['order'] != 0)
{
return $a['order'] - $b['order'];
}
elseif ($b['order'] != 0 && $a['order'] == 0)
{
return 1;
}
elseif ($a['order'] != 0 && $b['order'] == 0)
{
return 0;
}
return 1;
});
// load the view and field data
foreach ($component->admin_views as $key => &$view)
{
if ($view['port'] && !$this->addEximport)
{
$this->addEximport = true;
}
if ($view['history'] && !$this->setTagHistory)
{
$this->setTagHistory = true;
}
if ($view['edit_create_site_view'])
{
$this->siteEditView[$view['adminview']] = true;
}
// TODO this is a temp fix until front view is added
$view['view'] = $view['adminview'];
$view['settings'] = $this->getAdminViewData($view['view']);
}
unset($component->addadmin_view);
}
// set the site_view data
$site_views = json_decode($component->addsite_views,true);
if (ComponentbuilderHelper::checkArray($site_views))
{
foreach ($site_views as $option => $values)
{
foreach ($values as $nr => $value)
{
if ((string)(int)$value == $value)
{
$component->site_views[$nr][$option] = (int) $value;
}
else
{
$component->site_views[$nr][$option] = $value;
}
}
}
unset($component->addsite_views);
$this->lang = 'site';
$this->target = 'site';
// load the view and field data
if (isset($component->site_views) && ComponentbuilderHelper::checkArray($component->site_views))
{
foreach ($component->site_views as $key => &$view)
{
// has become a lacacy issue, can't remove this
$view['view'] = $view['siteview'];
$view['settings'] = $this->getCustomViewData($view['view']);
}
}
}
// set the custom_admin_views data
$custom_admin_views = json_decode($component->addcustom_admin_views,true);
if (ComponentbuilderHelper::checkArray($custom_admin_views))
{
foreach ($custom_admin_views as $option => $values)
{
foreach ($values as $nr => $value)
{
if ((string)(int)$value == $value)
{
$component->custom_admin_views[$nr][$option] = (int) $value;
}
else
{
$component->custom_admin_views[$nr][$option] = $value;
}
}
}
unset($component->addcustom_admin_views);
$this->lang = 'admin';
$this->target = 'custom_admin';
// load the view and field data
if (isset($component->custom_admin_views) && ComponentbuilderHelper::checkArray($component->custom_admin_views))
{
foreach ($component->custom_admin_views as $key => &$view)
{
// has become a lacacy issue, can't remove this
$view['view'] = $view['customadminview'];
$view['settings'] = $this->getCustomViewData($view['view'], 'custom_admin_view');
}
}
}
// ser the config data
$addconfig = json_decode($component->addconfig,true);
if (ComponentbuilderHelper::checkArray($addconfig))
{
foreach ($addconfig as $option => $values)
{
foreach ($values as $nr => $value)
{
$component->config[$nr]['alias'] = 0;
$component->config[$nr]['title'] = 0;
if ($option === 'field')
{
// load the field data
$component->config[$nr]['settings'] = $this->getFieldData($value);
}
else
{
$component->config[$nr][$option] = $value;
}
}
}
unset($component->addconfig);
}
// check if any contributors is to be added
$contributors = json_decode($component->addcontributors,true);
if (ComponentbuilderHelper::checkArray($contributors))
{
$this->addContributors = true;
foreach ($contributors as $option => $values)
{
foreach ($values as $nr => $value)
{
$component->contributors[$nr][$option] = $value;
}
}
unset($component->addcontributors);
}
// check if version updating is set
$version_update = json_decode($component->version_update,true);
if (ComponentbuilderHelper::checkArray($version_update))
{
$component->version_update = array();
foreach ($version_update as $option => $values)
{
foreach ($values as $nr => $value)
{
$component->version_update[$nr][$option] = $value;
}
}
}
// build update SQL
if ($old_component = $this->getHistoryWatch('joomla_component', $this->componentID))
{
// add new views if found
if (isset($old_component->addadmin_views) && ComponentbuilderHelper::checkJson($old_component->addadmin_views))
{
$this->setUpdateSQL(json_decode($old_component->addadmin_views, true), $admin_views, 'adminview');
}
// check if a new version was manualy set
$old_component_version = preg_replace('/[^0-9.]+/', '', $old_component->component_version);
if ($old_component_version != $this->component_version)
{
// yes, this is a new version, this mean there may be manual sql and must be checked and updated
$component->old_component_version = $old_component_version;
}
// clear this data
unset($old_component);
}
// add_css
if ($component->add_css == 1)
{
$this->customScriptBuilder['component_css'] = base64_decode($component->css);
}
else
{
$this->customScriptBuilder['component_css'] = '';
}
unset($component->css);
// set the lang target
$this->lang = 'admin';
// add PHP in ADMIN
$addScriptMethods = array('php_preflight','php_postflight','php_method');
$addScriptTypes = array('install','update','uninstall');
foreach ($addScriptMethods as $scriptMethod)
{
foreach ($addScriptTypes as $scriptType)
{
if (isset($component->{'add_'.$scriptMethod.'_'.$scriptType}) && $component->{'add_'.$scriptMethod.'_'.$scriptType} == 1 && ComponentbuilderHelper::checkString($component->{$scriptMethod.'_'.$scriptType}))
{
$this->customScriptBuilder[$scriptMethod][$scriptType] = $this->setDynamicValues(base64_decode($component->{$scriptMethod.'_'.$scriptType}));
}
else
{
$this->customScriptBuilder[$scriptMethod][$scriptType] = '';
}
unset($component->{$scriptMethod.'_'.$scriptType});
}
}
// add_php_helper
if ($component->add_php_helper_admin == 1 && ComponentbuilderHelper::checkString($component->php_helper_admin))
{
$this->lang = 'admin';
$this->customScriptBuilder['component_php_helper_admin'] = PHP_EOL.PHP_EOL.$this->setDynamicValues(base64_decode($component->php_helper_admin));
}
else
{
$this->customScriptBuilder['component_php_helper_admin'] = '';
}
unset($component->php_helper);
// add_admin_event
if ($component->add_admin_event == 1 && ComponentbuilderHelper::checkString($component->php_admin_event))
{
$this->lang = 'admin';
$this->customScriptBuilder['component_php_admin_event'] = $this->setDynamicValues(base64_decode($component->php_admin_event));
}
else
{
$this->customScriptBuilder['component_php_admin_event'] = '';
}
unset($component->php_admin_event);
// add_php_helper_both
if ($component->add_php_helper_both == 1 && ComponentbuilderHelper::checkString($component->php_helper_both))
{
$this->lang = 'both';
$this->customScriptBuilder['component_php_helper_both'] = PHP_EOL.PHP_EOL.$this->setDynamicValues(base64_decode($component->php_helper_both));
}
else
{
$this->customScriptBuilder['component_php_helper_both'] = '';
}
// add_php_helper_site
if ($component->add_php_helper_site == 1 && ComponentbuilderHelper::checkString($component->php_helper_site))
{
$this->lang = 'site';
$this->customScriptBuilder['component_php_helper_site'] = PHP_EOL.PHP_EOL.$this->setDynamicValues(base64_decode($component->php_helper_site));
}
else
{
$this->customScriptBuilder['component_php_helper_site'] = '';
}
unset($component->php_helper);
// add_site_event
if ($component->add_site_event == 1 && ComponentbuilderHelper::checkString($component->php_site_event))
{
$this->lang = 'site';
$this->customScriptBuilder['component_php_site_event'] = $this->setDynamicValues(base64_decode($component->php_site_event));
}
else
{
$this->customScriptBuilder['component_php_site_event'] = '';
}
unset($component->php_site_event);
// add_sql
if ($component->add_sql == 1)
{
$this->customScriptBuilder['sql']['component_sql'] = base64_decode($component->sql);
}
unset($component->sql);
// bom
if (ComponentbuilderHelper::checkString($component->bom))
{
$this->bomPath = $this->compilerPath.'/'.$component->bom;
}
else
{
$this->bomPath = $this->compilerPath.'/default.txt';
}
unset($component->bom);
// README
if ($component->addreadme)
{
$component->readme = base64_decode($component->readme);
}
else
{
$component->readme = '';
}
// dashboard methods