-
Notifications
You must be signed in to change notification settings - Fork 2
/
PageContentHelper.php
51 lines (41 loc) · 1.18 KB
/
PageContentHelper.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
<?php
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
class PageContentHelper
{
public function __construct(){
$this->LanguageRepository = new LanguageRepository;
}
public function GetPageText($page){
$this->DetermineLanguage();
//If Dutch is chosen switch to it.
if (isset($_SESSION['Language']) && EncryptionHelper::Decrypt($_SESSION['Language']) == 'Dutch') {
return $this->LanguageRepository->Get_PageTextDutch($page);
}
//By default we use English.
else{
return $this->LanguageRepository->Get_PageTextEnglish($page);
}
}
public function DetermineLanguage(){
//If a language is chosen switch to it.
if (isset($_GET['Language'])) {
$_SESSION['Language'] = EncryptionHelper::Encrypt($_GET['Language']);
}
}
public function GetPageImage($page){
$images = $this->LanguageRepository->Get_PageImage($page);
//Modify the image paths so they get the images from the cms folder
$newImages = array();
foreach ($images as $image) {
array_push($newImages, $this->ModifyImageURL($image));
}
return $newImages;
}
public function ModifyImageURL($image){
$newUrl = "http://hfteam3.infhaarlem.nl/cms/" . $image;
return $newUrl;
}
}
?>