@@ 14-89 (lines=76) @@ | ||
11 | * |
|
12 | * @package app\commands\models\sitemap |
|
13 | */ |
|
14 | class SitemapAbout extends About implements Basic |
|
15 | { |
|
16 | /** |
|
17 | * Handle materials by selecting batch of elements. |
|
18 | * Increase this value and got more handling speed but more memory usage. |
|
19 | * |
|
20 | * @var int |
|
21 | */ |
|
22 | public $sitemapBatchSize = 10; |
|
23 | ||
24 | /** |
|
25 | * @var About |
|
26 | */ |
|
27 | private $model; |
|
28 | ||
29 | /** |
|
30 | * @inheritdoc |
|
31 | */ |
|
32 | public function getSitemapItems($lang = null) |
|
33 | { |
|
34 | $this->model = About::getDefaultAbout(); |
|
35 | ||
36 | if (empty($this->model)) { |
|
37 | return null; |
|
38 | } |
|
39 | ||
40 | return [ |
|
41 | [ |
|
42 | 'loc' => Url::to('/about', true), |
|
43 | 'lastmod' => $this->getSitemapLastmod(), |
|
44 | 'changefreq' => $this->getSitemapChangefreq(), |
|
45 | 'priority' => $this->getSitemapPriority(), |
|
46 | ], |
|
47 | ]; |
|
48 | } |
|
49 | ||
50 | /** |
|
51 | * @inheritdoc |
|
52 | */ |
|
53 | public function getSitemapItemsQuery($lang = null) |
|
54 | { |
|
55 | return null; |
|
56 | } |
|
57 | ||
58 | /** |
|
59 | * @inheritdoc |
|
60 | */ |
|
61 | public function getSitemapLoc($lang = null) |
|
62 | { |
|
63 | return Url::to('/about', true); |
|
64 | } |
|
65 | ||
66 | /** |
|
67 | * @inheritdoc |
|
68 | */ |
|
69 | public function getSitemapLastmod($lang = null) |
|
70 | { |
|
71 | return (new \DateTime($this->model->updated_at))->getTimestamp(); |
|
72 | } |
|
73 | ||
74 | /** |
|
75 | * @inheritdoc |
|
76 | */ |
|
77 | public function getSitemapChangefreq($lang = null) |
|
78 | { |
|
79 | return static::CHANGEFREQ_MONTHLY; |
|
80 | } |
|
81 | ||
82 | /** |
|
83 | * @inheritdoc |
|
84 | */ |
|
85 | public function getSitemapPriority($lang = null) |
|
86 | { |
|
87 | return static::PRIORITY_8; |
|
88 | } |
|
89 | } |
|
90 |
@@ 14-89 (lines=76) @@ | ||
11 | * |
|
12 | * @package app\commands\models\sitemap |
|
13 | */ |
|
14 | class SitemapContact extends Contact implements Basic |
|
15 | { |
|
16 | /** |
|
17 | * Handle materials by selecting batch of elements. |
|
18 | * Increase this value and got more handling speed but more memory usage. |
|
19 | * |
|
20 | * @var int |
|
21 | */ |
|
22 | public $sitemapBatchSize = 10; |
|
23 | ||
24 | /** |
|
25 | * @var Contact |
|
26 | */ |
|
27 | private $model; |
|
28 | ||
29 | /** |
|
30 | * @inheritdoc |
|
31 | */ |
|
32 | public function getSitemapItems($lang = null) |
|
33 | { |
|
34 | $this->model = Contact::getDefaultContacts(); |
|
35 | ||
36 | if (empty($this->model)) { |
|
37 | return null; |
|
38 | } |
|
39 | ||
40 | return [ |
|
41 | [ |
|
42 | 'loc' => Url::to('/contact', true), |
|
43 | 'lastmod' => $this->getSitemapLastmod(), |
|
44 | 'changefreq' => $this->getSitemapChangefreq(), |
|
45 | 'priority' => $this->getSitemapPriority(), |
|
46 | ], |
|
47 | ]; |
|
48 | } |
|
49 | ||
50 | /** |
|
51 | * @inheritdoc |
|
52 | */ |
|
53 | public function getSitemapItemsQuery($lang = null) |
|
54 | { |
|
55 | return null; |
|
56 | } |
|
57 | ||
58 | /** |
|
59 | * @inheritdoc |
|
60 | */ |
|
61 | public function getSitemapLoc($lang = null) |
|
62 | { |
|
63 | return Url::to('/contact', true); |
|
64 | } |
|
65 | ||
66 | /** |
|
67 | * @inheritdoc |
|
68 | */ |
|
69 | public function getSitemapLastmod($lang = null) |
|
70 | { |
|
71 | return (new \DateTime($this->model->updated_at))->getTimestamp(); |
|
72 | } |
|
73 | ||
74 | /** |
|
75 | * @inheritdoc |
|
76 | */ |
|
77 | public function getSitemapChangefreq($lang = null) |
|
78 | { |
|
79 | return static::CHANGEFREQ_MONTHLY; |
|
80 | } |
|
81 | ||
82 | /** |
|
83 | * @inheritdoc |
|
84 | */ |
|
85 | public function getSitemapPriority($lang = null) |
|
86 | { |
|
87 | return static::PRIORITY_8; |
|
88 | } |
|
89 | } |
|
90 |
@@ 14-89 (lines=76) @@ | ||
11 | * |
|
12 | * @package app\commands\models\sitemap |
|
13 | */ |
|
14 | class SitemapHome extends Home implements Basic |
|
15 | { |
|
16 | /** |
|
17 | * Handle materials by selecting batch of elements. |
|
18 | * Increase this value and got more handling speed but more memory usage. |
|
19 | * |
|
20 | * @var int |
|
21 | */ |
|
22 | public $sitemapBatchSize = 10; |
|
23 | ||
24 | /** |
|
25 | * @var Home |
|
26 | */ |
|
27 | private $model; |
|
28 | ||
29 | /** |
|
30 | * @inheritdoc |
|
31 | */ |
|
32 | public function getSitemapItems($lang = null) |
|
33 | { |
|
34 | $this->model = Home::getDefaultHome(); |
|
35 | ||
36 | if (empty($this->model)) { |
|
37 | return null; |
|
38 | } |
|
39 | ||
40 | return [ |
|
41 | [ |
|
42 | 'loc' => Url::to('/', true), |
|
43 | 'lastmod' => $this->getSitemapLastmod(), |
|
44 | 'changefreq' => $this->getSitemapChangefreq(), |
|
45 | 'priority' => $this->getSitemapPriority(), |
|
46 | ], |
|
47 | ]; |
|
48 | } |
|
49 | ||
50 | /** |
|
51 | * @inheritdoc |
|
52 | */ |
|
53 | public function getSitemapItemsQuery($lang = null) |
|
54 | { |
|
55 | return null; |
|
56 | } |
|
57 | ||
58 | /** |
|
59 | * @inheritdoc |
|
60 | */ |
|
61 | public function getSitemapLoc($lang = null) |
|
62 | { |
|
63 | return Url::to('/', true); |
|
64 | } |
|
65 | ||
66 | /** |
|
67 | * @inheritdoc |
|
68 | */ |
|
69 | public function getSitemapLastmod($lang = null) |
|
70 | { |
|
71 | return (new \DateTime($this->model->updated_at))->getTimestamp(); |
|
72 | } |
|
73 | ||
74 | /** |
|
75 | * @inheritdoc |
|
76 | */ |
|
77 | public function getSitemapChangefreq($lang = null) |
|
78 | { |
|
79 | return static::CHANGEFREQ_MONTHLY; |
|
80 | } |
|
81 | ||
82 | /** |
|
83 | * @inheritdoc |
|
84 | */ |
|
85 | public function getSitemapPriority($lang = null) |
|
86 | { |
|
87 | return static::PRIORITY_8; |
|
88 | } |
|
89 | } |
|
90 |