-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathxpandslider_setup.php
128 lines (114 loc) · 4.69 KB
/
xpandslider_setup.php
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
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2018 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* xpandSlider plugin - Perfect responsive image, HTML slider for e107 CMS
* Author: rolla <[email protected]>
*
*/
require_once("conf.php");
if (!defined('e107_INIT')) {
require_once("../../class2.php");
}
$xpandSliderPrefs = e107::getPlugPref(XPNSLD_NAME); // get plugin prefs
if (!defined('XPNSLD_DEBUG')) {
define('XPNSLD_DEBUG', $xpandSliderPrefs['xpnsld_debug']);
}
class xpandslider_setup {
function install_post($var)
{
$sql = e107::getDb();
$mes = e107::getMessage();
$xpndSldExtra = [
0 => ["captionFx" => "fadeFromRight", "alignment" => "topCenter",],
1 => ["captionFx" => "fadeIn"],
2 => ["captionFx" => "moveFromBottom"],
3 => [
"captionFx" => "fadeFromTop",
"alignment" => "center",
"portrait" => "false",
"link" => "//facebook.com/djbeatermusic",
"target" => "_blank"
],
];
$xpandSlider = [
0 => [
'caption' => 'xpandSlider Caption 1!',
'content' => '<div class="fadeIn camera_effected"><b>xpandSlider 1 HTML content!</b></div>',
'image' => 'demo/1.jpg',
'created' => date('Y-m-d H:i:s'),
'updated' => date('Y-m-d H:i:s'),
'extra' => json_encode($xpndSldExtra[0]),
'visibility' => 0,
'position' => 1
],
1 => [
'caption' => 'xpandSlider can handle also videos!',
'content' => '<iframe width="100%" height="100%" src="https://www.youtube.com/embed/11Qbbipv8dE" frameborder="0"></iframe>',
'image' => 'demo/2.jpg',
'created' => date('Y-m-d H:i:s'),
'updated' => date('Y-m-d H:i:s'),
'extra' => json_encode($xpndSldExtra[1]),
'visibility' => 0,
'position' => 2
],
2 => [
'caption' => 'xpandSlider Caption 3!',
'content' => '
<div class="fadeIn camera_effected"><b>xpandSlider 3 HTML content!</b></div>
<div class="fadeIn camera_effected">Camere line 1</div>
<div class="fadeIn camera_effected">Camere line 2</div>
<div class="fadeIn camera_effected">Camere line 3</div>
<div class="fadeIn camera_effected">Camere line 4</div>
',
'image' => 'demo/3.jpg',
'created' => date('Y-m-d H:i:s'),
'updated' => date('Y-m-d H:i:s'),
'extra' => json_encode($xpndSldExtra[2]),
'visibility' => 0,
'position' => 3
],
3 => [
'caption' => 'xpandSlider Caption 4!',
'content' => '<div class="fadeIn camera_effected"><b>xpandSlider 4 HTML content with link!</b></div>',
'image' => 'xpandSlider-na.jpg',
'created' => date('Y-m-d H:i:s'),
'updated' => date('Y-m-d H:i:s'),
'extra' => json_encode($xpndSldExtra[3]),
'visibility' => 0,
'position' => 4
]
];
foreach ($xpandSlider as $slide) {
if ($sql->insert(XPNSLD_DB, $slide, false)) {
$mes->add('Added ' . $slide['caption'], E_MESSAGE_SUCCESS);
} else {
$mes->add('Error adding '. $slide['caption'], E_MESSAGE_ERROR);
}
}
$files = e107::getFile()->get_files(e_PLUGIN . "xpandslider/snippets");
foreach ($files as $file) {
if (copy($file['path'] . $file['fname'], e_PLUGIN . "tinymce4/snippets/" . $file['fname'])) {
$mes->add('Copied ' . $file['path'] . $file['fname'] . ' to tinymce4/snippets/', E_MESSAGE_SUCCESS);
} else {
$mes->add('Error copying ' . $file['path'] . $file['fname'] . ' to tinymce4/snippets/', E_MESSAGE_ERROR);
}
}
}
function uninstall_post($var)
{
$mes = e107::getMessage();
$files = ['xpandslider_htmlcontent.htm', 'xpandslider_videocontent.htm'];
foreach ($files as $file) {
if (unlink(e_PLUGIN . "tinymce4/snippets/" . $file)) {
$mes->add('Removed ' . $file . ' from tinymce4/snippets/', E_MESSAGE_SUCCESS);
} else {
$mes->add('Error remove ' . $file . ' from tinymce4/snippets/', E_MESSAGE_ERROR);
}
}
}
}