@@ -389,8 +389,8 @@ private function getHeader(bool|string|array $css = false, bool|string|array $js
389
389
"slider_interval " => $ this ->CI ->config ->item ('slider_interval ' ),
390
390
"slider_style " => $ this ->CI ->config ->item ('slider_style ' ),
391
391
"vote_reminder " => $ this ->voteReminder (),
392
- "keywords " => ($ this ->custom_keywords ) ? $ this -> custom_keywords : $ this ->CI ->config ->item ("keywords " ),
393
- "description " => ($ this ->custom_description ) ? $ this -> custom_description : $ this ->CI ->config ->item ("description " ),
392
+ "keywords " => ($ this ->custom_keywords ) ?? $ this ->CI ->config ->item ("keywords " ),
393
+ "description " => ($ this ->custom_description ) ?? $ this ->CI ->config ->item ("description " ),
394
394
"menu_top " => $ this ->getMenu ("top " ),
395
395
"menu_side " => $ this ->getMenu ("side " ),
396
396
"menu_bottom " => $ this ->getMenu ("bottom " ),
@@ -410,12 +410,12 @@ private function getHeader(bool|string|array $css = false, bool|string|array $js
410
410
"cdn_link " => $ this ->CI ->config ->item ('cdn ' ) === true ? $ this ->CI ->config ->item ('cdn_link ' ) : null ,
411
411
"isOnline " => $ this ->CI ->user ->isOnline (),
412
412
"isRTL " => $ this ->CI ->language ->getLanguage () == 'persian ' || $ this ->CI ->language ->getClientData () == 'persian ' ,
413
- "social_media " => array (
413
+ "social_media " => [
414
414
'facebook ' => $ this ->CI ->config ->item ('facebook ' ),
415
415
'twitter ' => $ this ->CI ->config ->item ('twitter ' ),
416
416
'youtube ' => $ this ->CI ->config ->item ('youtube ' ),
417
417
'discord ' => $ this ->CI ->config ->item ('discord ' )
418
- ) ,
418
+ ] ,
419
419
"use_captcha " => false ,
420
420
"captcha_type " => $ this ->CI ->config ->item ('captcha_type ' )
421
421
);
@@ -459,48 +459,39 @@ private function voteReminder(): bool|string
459
459
*/
460
460
public function loadSideboxes (string $ location = 'side ' ): array
461
461
{
462
- $ out = [];
462
+ $ output = [];
463
+ $ module = CI ::$ APP ->router ->fetch_module ();
464
+ $ sideBoxes = $ this ->CI ->cms_model ->getSideboxes ($ location , $ module );
463
465
464
- $ sideBoxes_db = $ this ->CI ->cms_model ->getSideboxes ($ location , CI ::$ APP ->router ->fetch_module ());
465
-
466
- // If we got sideboxes
467
- if ($ sideBoxes_db )
468
- {
469
- // Go through them all and add them to the output.
470
- foreach ($ sideBoxes_db as $ sideBox )
471
- {
472
- if ($ sideBox ['permission ' ] && !hasViewPermission ($ sideBox ['permission ' ], "--SIDEBOX-- " ))
473
- continue ;
466
+ foreach ((array ) $ sideBoxes as $ sideBox ) {
467
+ if ($ sideBox ['permission ' ] && !hasViewPermission ($ sideBox ['permission ' ], "--SIDEBOX-- " )) {
468
+ continue ;
469
+ }
474
470
475
- $ fileLocation = 'application/modules/sidebox_ ' . $ sideBox ['type ' ] . '/controllers/ ' . ucfirst ($ sideBox ['type ' ]) . '.php ' ;
471
+ $ sideboxType = $ sideBox ['type ' ];
472
+ $ fileLocation = APPPATH . 'modules/sidebox_ ' . $ sideboxType . '/controllers/ ' . ucfirst ($ sideboxType ) . '.php ' ;
476
473
477
- if (file_exists ($ fileLocation ))
478
- {
479
- require_once ($ fileLocation );
480
-
481
- if ($ sideBox ['type ' ] == 'custom ' )
482
- $ object = new $ sideBox ['type ' ]($ sideBox ['id ' ]);
483
- else
484
- $ object = new $ sideBox ['type ' ]();
485
-
486
- $ out [] = array (
487
- 'name ' => langColumn ($ sideBox ['displayName ' ]),
488
- 'location ' => $ sideBox ['location ' ],
489
- 'data ' => $ object ->view (),
490
- 'type ' => $ sideBox ['type ' ]
491
- );
492
- }
493
- else
494
- {
495
- $ out [] = array (
496
- 'name ' => "Oops, something went wrong " ,
497
- 'data ' => 'The following sideBox module is missing or contains an invalid module structure: <b>sidebox_ ' . $ sideBox ['type ' ] . '</b> '
498
- );
499
- }
474
+ if (!file_exists ($ fileLocation )) {
475
+ $ output [] = [
476
+ 'name ' => "Oops, something went wrong " ,
477
+ 'data ' => 'The following sideBox module is missing or contains an invalid module structure: <b>sidebox_ ' . $ sideboxType . '</b> '
478
+ ];
479
+ continue ;
500
480
}
481
+
482
+ require_once ($ fileLocation );
483
+
484
+ $ object = ($ sideboxType === 'custom ' ) ? new $ sideboxType ($ sideBox ['id ' ]) : new $ sideboxType ();
485
+
486
+ $ output [] = [
487
+ 'name ' => langColumn ($ sideBox ['displayName ' ]),
488
+ 'location ' => $ sideBox ['location ' ],
489
+ 'data ' => $ object ->view (),
490
+ 'type ' => $ sideboxType ,
491
+ ];
501
492
}
502
493
503
- return $ out ;
494
+ return $ output ;
504
495
}
505
496
506
497
/**
@@ -510,7 +501,7 @@ public function loadSideboxes(string $location = 'side'): array
510
501
* @param Array $data Array of additional template data
511
502
* @return String
512
503
*/
513
- public function loadPage (string $ page , array $ data = array () ): string
504
+ public function loadPage (string $ page , array $ data = [] ): string
514
505
{
515
506
// Get the module, we need to check if it's enabled first
516
507
$ data ['module ' ] = array_key_exists ("module " , $ data ) ? $ data ['module ' ] : $ this ->module_name ;
0 commit comments