-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.php
More file actions
99 lines (65 loc) · 2.23 KB
/
Copy pathconfig.php
File metadata and controls
99 lines (65 loc) · 2.23 KB
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
<?php
$application = \Cetera\Application::getInstance();
$t = $this->getTranslator();
$twig = $application->getTwig();
$t->addTranslation(__DIR__ . '/lang');
$this->registerWidget(array(
'name' => 'cities',
'class' => '\\Cities\\WidgetCity',
'describ' => $t->_('Города'),
'icon' => 'city.png',
'ui' => 'Plugin.cities.Widget',
));
$this->registerWidget(array(
'name' => 'cities.location',
'class' => '\\Cities\\WidgetLocation',
'describ' => $t->_('Определение города'),
'icon' => 'location.png',
'ui' => 'Plugin.cities.WidgetLocation',
));
//$this->registerWidget(array(
// 'name' => 'cities.menu.user',
// 'class' => '\\Cities\\MenuUserSeo',
// 'describ' => $t->_('Пользовательское SEO меню'),
// 'icon' => 'city.png',
// 'ui' => 'Plugin.cities.Widget',
//));
if ($this->getBo() && $this->getUser() && $this->getUser()->isAdmin()) {
$this->getBo()->addModule(array(
'id' => 'cities',
'position' => MENU_SITE,
'name' => $t->_('Города'),
'icon' => 'city.png',
'class' => 'Plugin.cities.Panel'
));
}
try {
\Cities\Accessory\Init::init($twig);
} catch (Exception $e) {
if (getenv('RUN_MODE')=== "development"){
echo '<pre>';
echo 'Init fail<br>';
var_dump($e);
echo '<pre>';
}
}
$cityObject = new \Cities\Reason\City();
$material = $cityObject->getCityMaterial();
if (!empty($material->settings->fields['robots_file'])) {
$application->route('/robots.txt', function () use ($material) {
$robotsText = $material->settings->fields['robots_file'];
$result = str_replace('[link]', $material->city->link, trim($robotsText, "\n"));
header('Content-type: text/plain');
echo $result;
return true;
});
}
if (!empty($material->settings->fields['sitemap_file']) && $material->settings->isUseSitemap()) {
$application->route('/sitemap.xml', function () use ($material) {
$sitemap = $material->settings->fields['sitemap_file'];
$result = str_replace('[link]', $material->city->link, trim($sitemap, "\n"));
header("Content-type: text/xml");
echo $result;
return true;
});
}