1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use template_manager\classes\TemplateManager; |
4
|
|
|
|
5
|
|
|
if (!defined('BASEPATH')) { |
6
|
|
|
exit('No direct script access allowed'); |
7
|
|
|
} |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* ImageCMS |
11
|
|
|
* siteinfo helper |
12
|
|
|
*/ |
13
|
|
|
if (!function_exists('siteinfo')) { |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Get information about site |
17
|
|
|
* |
18
|
|
|
* @param string $name - name of siteinfo param |
19
|
|
|
* - siteinfo_compatyname |
20
|
|
|
* - siteinfo_address |
21
|
|
|
* - siteinfo_mainphone |
22
|
|
|
* - siteinfo_contacts |
23
|
|
|
* - siteinfo_logo |
24
|
|
|
* - siteinfo_favicon |
25
|
|
|
* - "or some contact name" |
26
|
|
|
* @return bool|string |
27
|
|
|
*/ |
28
|
|
|
function siteinfo($name = NULL) { |
29
|
|
|
|
30
|
|
|
// for shorter notation... |
31
|
|
|
if (0 !== strpos($name, 'siteinfo_')) { |
32
|
|
|
$name = 'siteinfo_' . $name; |
33
|
|
|
} |
34
|
|
|
$ci = &get_instance(); |
35
|
|
|
$ci->load->library('SiteInfo'); |
36
|
|
|
$siteinfo = new SiteInfo(); |
37
|
|
|
// next code is only for compatibility with older versions of library, |
38
|
|
|
// so in the future needed to be removed (with funciton processOldVersions() too) |
39
|
|
|
|
40
|
|
|
if (FALSE !== $data = siteInfoAdditionalManipulations($name)) { |
|
|
|
|
41
|
|
|
return $data; |
42
|
|
|
} else { |
43
|
|
|
$value = $siteinfo->getSiteInfo($name); |
44
|
|
|
|
45
|
|
|
if (in_array($name, ['siteinfo_logo', 'siteinfo_favicon'])) { |
46
|
|
|
return $ci->siteinfo->imagesPath . $value; |
47
|
|
|
} |
48
|
|
|
return $value; |
49
|
|
|
} |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
if (!function_exists('siteInfoAdditionalManipulations')) { |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Функція існує суто для сумісності із старими версіями |
58
|
|
|
* @deprecated since version 4.6 |
59
|
|
|
* @param string $name |
60
|
|
|
* @return string|boolean |
61
|
|
|
*/ |
62
|
|
|
function siteInfoAdditionalManipulations($name) { |
63
|
|
|
if (FALSE !== strpos($name, '_path')) { |
64
|
|
|
$name = str_replace('_path', '', $name); |
65
|
|
|
} |
66
|
|
|
if (FALSE !== strpos($name, '_url')) { |
67
|
|
|
$name = str_replace('_url', '', $name); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
$siteinfo = new SiteInfo(); |
71
|
|
|
$value = $siteinfo->getSiteInfo($name); |
72
|
|
|
switch ($name) { |
73
|
|
|
case 'siteinfo_favicon': |
74
|
|
|
case 'siteinfo_logo': |
75
|
|
|
// із врахуванням активного шаблону |
76
|
|
|
if (is_array($value)) { |
77
|
|
|
$settings = CI::$APP->cms_base->get_settings(); |
78
|
|
|
if (array_key_exists($settings['site_template'], $value)) { |
79
|
|
|
$fileName = $value[$settings['site_template']]; |
80
|
|
|
if (SHOP_INSTALLED) { |
81
|
|
|
$colorScheme = CI::$APP->load->module('template_manager')->getComponent('TColorScheme')->getColorSheme(); |
82
|
|
|
|
83
|
|
|
return "/templates/{$settings['site_template']}/css/{$colorScheme}/{$fileName}"; |
84
|
|
|
} else { |
85
|
|
|
return "/templates/{$settings['site_template']}/images/{$fileName}"; |
86
|
|
|
} |
87
|
|
|
} elseif (count($value) > 0) { |
88
|
|
|
reset($value); |
89
|
|
|
$key = key($value); |
90
|
|
|
if (SHOP_INSTALLED) { |
91
|
|
|
$colorScheme = CI::$APP->load->module('template_manager')->getComponent('TColorScheme')->getColorSheme(); |
92
|
|
|
$template = TemplateManager::getInstance()->getCurentTemplate(); |
93
|
|
|
return '/templates/' . $template->name . "/css/{$colorScheme}/" . $value[$key]; |
94
|
|
|
} else { |
95
|
|
|
return "/templates/{$settings['site_template']}/images/" . array_shift($value); |
96
|
|
|
} |
97
|
|
|
} |
98
|
|
|
return ''; |
99
|
|
|
} elseif (is_string($value)) { |
100
|
|
|
return empty($value) ? '' : CI::$APP->siteinfo->imagesPath . $value; |
101
|
|
|
} |
102
|
|
|
} |
103
|
|
|
return false; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
} |
This function has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.