|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Created by PhpStorm. |
|
4
|
|
|
* User: Marky |
|
5
|
|
|
* Date: 31/12/2017 |
|
6
|
|
|
* Time: 00:15. |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace App\Classes\Library\PageLoader; |
|
10
|
|
|
|
|
11
|
|
|
use App\Model\Page; |
|
12
|
|
|
use Illuminate\Support\Collection; |
|
13
|
|
|
use App\Classes\Library\PageLoader\Coordinators\Contact; |
|
14
|
|
|
use App\Classes\Library\PageLoader\Coordinators\Frame; |
|
15
|
|
|
use App\Classes\Library\PageLoader\Coordinators\Plugins; |
|
16
|
|
|
use App\Classes\Library\PageLoader\Coordinators\Social; |
|
17
|
|
|
use App\Classes\Library\PageLoader\Coordinators\Navigation; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Class Webpage. |
|
21
|
|
|
*/ |
|
22
|
|
|
class Webpage |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* @var Page |
|
26
|
|
|
*/ |
|
27
|
|
|
private $page; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @var Navigation |
|
31
|
|
|
*/ |
|
32
|
|
|
public $navigation; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @var Frame |
|
36
|
|
|
*/ |
|
37
|
|
|
public $frame; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @var Social |
|
41
|
|
|
*/ |
|
42
|
|
|
public $social; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @var Contact |
|
46
|
|
|
*/ |
|
47
|
|
|
public $contact; |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @var Plugins |
|
51
|
|
|
*/ |
|
52
|
|
|
public $plugins; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @param Page $model |
|
56
|
|
|
* @param Collection $navigationRepository |
|
57
|
|
|
*/ |
|
58
|
|
|
public function __construct(Page $model, Collection $navigationRepository) |
|
59
|
|
|
{ |
|
60
|
|
|
$this->page = $model; |
|
61
|
|
|
|
|
62
|
|
|
$this->frame = app(Frame::class); |
|
63
|
|
|
|
|
64
|
|
|
$this->social = app(Social::class); |
|
65
|
|
|
|
|
66
|
|
|
$this->contact = app(Contact::class); |
|
67
|
|
|
|
|
68
|
|
|
$this->plugins = app(Plugins::class); |
|
69
|
|
|
|
|
70
|
|
|
$this->navigation = new Navigation($model, $navigationRepository); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function header() |
|
74
|
|
|
{ |
|
75
|
|
|
return $this->page->name(); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @return mixed |
|
80
|
|
|
*/ |
|
81
|
|
|
public function keywords() |
|
82
|
|
|
{ |
|
83
|
|
|
return $this->page->seo_keywords ?: settings()->getValue('page_keywords'); |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* @return mixed |
|
88
|
|
|
*/ |
|
89
|
|
|
public function description() |
|
90
|
|
|
{ |
|
91
|
|
|
return $this->page->seo_description ?: settings()->getValue('page_description'); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* @return string |
|
96
|
|
|
*/ |
|
97
|
|
|
public function content() |
|
98
|
|
|
{ |
|
99
|
|
|
return $this->page->content; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
public function title() |
|
103
|
|
|
{ |
|
104
|
|
|
if (settings()->getValue('seo_text') != '') { |
|
105
|
|
|
if (settings()->getValue('seo_position') == 'right') { |
|
106
|
|
|
return ucfirst($this->page->seo_title) . ' ' . settings()->getValue('seo_separator') . ' ' . settings()->getValue('seo_text'); |
|
|
|
|
|
|
107
|
|
|
} else { |
|
108
|
|
|
return settings()->getValue('seo_text') . ' ' . settings()->getValue('seo_separator') . ' ' . ucfirst($this->page->seo_title); |
|
|
|
|
|
|
109
|
|
|
} |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
return ucfirst($this->page->seo_title); |
|
113
|
|
|
} |
|
114
|
|
|
} |
|
115
|
|
|
|
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.