-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbrowser-selection_v0.2.153.xml
161 lines (120 loc) · 5.75 KB
/
browser-selection_v0.2.153.xml
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?xml version="1.0" encoding="utf-8"?>
<dleplugin>
<name>browser-selection by TCSE</name>
<description>Теги для веб-браузеров в шаблонизаторе DLE - Работает только при активации функции: Включить автоматическую поддержку смартфонов. </description>
<icon>engine/skins/images/browser_selection.png</icon>
<version>0.2.153.2</version>
<dleversion>15.3</dleversion>
<versioncompare>greater</versioncompare>
<upgradeurl></upgradeurl>
<filedelete>0</filedelete>
<mnotice>1</mnotice>
<mysqlinstall><![CDATA[]]></mysqlinstall>
<mysqlupgrade><![CDATA[]]></mysqlupgrade>
<mysqlenable><![CDATA[]]></mysqlenable>
<mysqldisable><![CDATA[]]></mysqldisable>
<mysqldelete><![CDATA[]]></mysqldelete>
<notice><![CDATA[
Плагин добавляет поддержку тегов для различный веб-браузеров основанных на php классе проекта http://mobiledetect.net
Добавлены новые тестовые теги :
[code]
[firefox] текст [/firefox] - отображает содержимое, если веб-браузер firefox
[not-firefox] текст [/not-firefox] - отображает содержимое, если веб-браузер не firefox
[opera] текст [/opera] - отображает содержимое, если веб-браузер opera
[not-opera] текст [/not-opera] - отображает содержимое, если веб-браузер не opera
[/code]
Стабильные теги :
[code]
[chrome] текст [/chrome] - отображает содержимое, если веб-браузер Chrome
[not-chrome] текст [/not-chrome] - отображает содержимое, если веб-браузер не Chrome
[safari] текст [/safari] - отображает содержимое, если веб-браузер Mobile Safari
[not-safari] текст [/not-safari] - отображает содержимое, если веб-браузер не Mobile Safari
[/code]
Официальная страница плагина [url]https://tcse-cms.com/works/1438-browser-selection-by-tcse.html[/url]
]]></notice>
<file name="engine/classes/templates.class.php">
<operation action="after">
<searchcode><![CDATA[if( $mobile_detect->isAndroidOS() ){
$this->android = true;
}]]></searchcode>
<replacecode><![CDATA[
// Описываем новые теги браузеров
if( $mobile_detect->isChrome() ){
$this->chrome = true;
}
if( $mobile_detect->isSafari() ){
$this->safari = true;
}
if( $mobile_detect->isOpera() ){
$this->opera = true;
}
if( $mobile_detect->isFirefox() ){
$this->firefox = true;
}
]]></replacecode>
<enabled>1</enabled>
</operation>
<operation action="after">
<searchcode><![CDATA[if (stripos ( $content, "android]" ) !== false) {
if($this->android) {
$content = str_ireplace( '[android]', "", $content );
$content = str_ireplace( '[/android]', "", $content );
$content = preg_replace( "#\[not-android\](.+?)\[/not-android\]#is", "", $content );
} else {
$content = str_ireplace( '[not-android]', "", $content );
$content = str_ireplace( '[/not-android]', "", $content );
$content = preg_replace( "#\[android\](.+?)\[/android\]#is", "", $content );
}
}]]></searchcode>
<replacecode><![CDATA[
// Описываем новые теги браузеров
if (stripos ( $content, "chrome]" ) !== false) {
if($this->chrome) {
$content = str_ireplace( '[chrome]', "", $content );
$content = str_ireplace( '[/chrome]', "", $content );
$content = preg_replace( "#\[not-chrome\](.+?)\[/not-chrome\]#is", "", $content );
} else {
$content = str_ireplace( '[not-chrome]', "", $content );
$content = str_ireplace( '[/not-chrome]', "", $content );
$content = preg_replace( "#\[chrome\](.+?)\[/chrome\]#is", "", $content );
}
}
if (stripos ( $content, "safari]" ) !== false) {
if($this->safari) {
$content = str_ireplace( '[safari]', "", $content );
$content = str_ireplace( '[/safari]', "", $content );
$content = preg_replace( "#\[not-safari\](.+?)\[/not-safari\]#is", "", $content );
} else {
$content = str_ireplace( '[not-safari]', "", $content );
$content = str_ireplace( '[/not-safari]', "", $content );
$content = preg_replace( "#\[safari\](.+?)\[/safari\]#is", "", $content );
}
}
// 2022-10-20 теги для opera и firefox
if (stripos ( $content, "firefox]" ) !== false) {
if($this->firefox) {
$content = str_ireplace( '[firefox]', "", $content );
$content = str_ireplace( '[/firefox]', "", $content );
$content = preg_replace( "#\[not-firefox\](.+?)\[/not-firefox\]#is", "", $content );
} else {
$content = str_ireplace( '[not-firefox]', "", $content );
$content = str_ireplace( '[/not-firefox]', "", $content );
$content = preg_replace( "#\[firefox\](.+?)\[/firefox\]#is", "", $content );
}
}
if (stripos ( $content, "opera]" ) !== false) {
if($this->opera) {
$content = str_ireplace( '[opera]', "", $content );
$content = str_ireplace( '[/opera]', "", $content );
$content = preg_replace( "#\[not-opera\](.+?)\[/not-opera\]#is", "", $content );
} else {
$content = str_ireplace( '[not-opera]', "", $content );
$content = str_ireplace( '[/not-opera]', "", $content );
$content = preg_replace( "#\[opera\](.+?)\[/opera\]#is", "", $content );
}
}
]]></replacecode>
<enabled>1</enabled>
</operation>
</file>
</dleplugin>