-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanifest_proprietary.xml
More file actions
56 lines (53 loc) · 2.49 KB
/
manifest_proprietary.xml
File metadata and controls
56 lines (53 loc) · 2.49 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
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">
<extension engine="1.0">
<id>mapbbcode_proprietary</id>
<title>MapBBCode Add-ons</title>
<version>1.2.0</version>
<description>Add-ons and proprietary layers (e.g. Google Maps) for MapBBCode. Note: MapBBCode extension should be installed and mapbbcode-window.html in it should be writable!</description>
<author>Ilya Zverev</author>
<minversion>1.3</minversion>
<maxtestedon>1.4.2</maxtestedon>
<install><![CDATA[
$html = str_replace('_proprietary', '', $ext_info['path']).'/js/mapbbcode-window.html';
if( file_exists($html) ) {
$content = @file_get_contents($html);
if( strlen($content) > 100 && strpos('proprietary start', $content) === false ) {
$mapbb_libpath = '_';
// copy-paste from "pun_mapbbcode_js_proprietary" hook
$propr = '';
$propr .= '<script src="'.$mapbb_libpath.'/proprietary/Bing.js"></script>';
//$propr .= '<script src="'.$mapbb_libpath.'/proprietary/Esri.js"></script>';
//$propr .= '<script src="'.$mapbb_libpath.'/proprietary/Google.js"></script>';
//$propr .= '<script src="'.$mapbb_libpath.'/proprietary/Yandex.js"></script>';
$propr .= '<script src="'.$mapbb_libpath.'/Handler.Length.js"></script>';
// end copy-paste
$propr = "<!-- proprietary start -->".str_replace('"_/', '"', $propr)."<!-- proprietary end -->\n";
$content = preg_replace('#<!-- put MapBBCode add-ons here -->#', $propr.'$0', $content);
@file_put_contents($html, $content);
}
}
]]></install>
<uninstall><![CDATA[
$html = str_replace('_proprietary', '', $ext_info['path']).'/js/mapbbcode-window.html';
if( file_exists($html) ) {
$content = @file_get_contents($html);
if( strlen($content) > 100 && strpos('proprietary start', $content) === false ) {
$propr = "<!-- proprietary start -->.+<!-- proprietary end -->\s+";
$content = preg_replace('#'.$propr.'#s', '', $content);
@file_put_contents($html, $content);
}
}
]]></uninstall>
<hooks>
<hook id="pun_mapbbcode_js_proprietary"><![CDATA[
$propr = '';
$propr .= '<script src="'.$mapbb_libpath.'/proprietary/Bing.js"></script>';
//$propr .= '<script src="'.$mapbb_libpath.'/proprietary/Esri.js"></script>';
//$propr .= '<script src="'.$mapbb_libpath.'/proprietary/Google.js"></script>';
//$propr .= '<script src="'.$mapbb_libpath.'/proprietary/Yandex.js"></script>';
$propr .= '<script src="'.$mapbb_libpath.'/Handler.Length.js"></script>';
return $propr;
]]></hook>
</hooks>
</extension>