forked from wp-plugins/slider-image
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslider_front_end.html.php
327 lines (296 loc) · 20.8 KB
/
slider_front_end.html.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
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
<?php
//TODO put in auto loader
require("classes/AssetPipeline.php");
require("classes/CSSAsset.php");
use WordWrap\CSSAsset;
function front_end_slider($images, $paramssld, $slider)
{
$imageLink = false;//TODO make dynamic
ob_start();
$fancybox = $slider[0]->fancybox;
$overflowVisible = false;
$startFancy = $slider[0]->default_fancybox;
$auto_play = $slider[0]->autoplay;
$sliderID=$slider[0]->id;
$slidertitle=$slider[0]->name;
$sliderheight=$slider[0]->sl_height;
$sliderwidth=$slider[0]->sl_width;
$slidereffect=$slider[0]->slider_list_effects_s;
$slidepausetime=($slider[0]->description+$slider[0]->param);
$sliderpauseonhover=$slider[0]->pause_on_hover;
$sliderposition=$slider[0]->sl_position;
$slidechangespeed=$slider[0]->param;
$sliderloadingicon=$slider[0]->sl_loading_icon;
$trim_slideshow_title_position =trim($paramssld['slider_title_position']);
$slideshow_title_position = explode('-', $trim_slideshow_title_position);
$trim_slideshow_description_position = trim($paramssld['slider_description_position']);
$slideshow_description_position = explode('-', $trim_slideshow_description_position);
if ($fancybox) {
wp_enqueue_script("fancy_box_js", plugins_url("js/jquery.fancybox.pack.js", __FILE__), FALSE);
wp_enqueue_style("fancy_box_css", plugins_url("style/jquery.fancybox.css", __FILE__), FALSE);
}
$hasyoutube=false;
$hasvimeo=false;
foreach ($images as $key => $image_row) {
if(strpos($image_row->image_url,'youtube') !== false || strpos($image_row->image_url,'youtu.be') !== false){$hasyoutube=true;}
if(strpos($image_row->image_url,'vimeo') !== false){$hasvimeo=true;}
}
require("slider_front_end.js.php");
require("slider_front_end.css.old.php");
$cssAssets = new CSSAsset(plugin_dir_path( __FILE__ ) . "style/");
if($slidereffect == "fade")
$cssAssets->addAsset("sliders/" . $slidereffect);
$cssAssets->dumpAssets();
$args = array(
'numberposts' => 10,
'offset' => 0,
'category' => 0,
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => 'post',
'post_status' => 'draft, publish, future, pending, private',
'suppress_filters' => true );
$recent_posts = wp_get_recent_posts( $args, ARRAY_A );
//print_r($recent_posts);
//echo get_the_post_thumbnail(1, 'thumbnail');
$image = wp_get_attachment_image_src( get_post_thumbnail_id( 1 ), 'thumbnail' );
?>
<?php if($sliderloadingicon == "on") { ?>
<div class="elegant_slideshow_image_wrap huge_it_slideshow_image_wrap_<?php echo $sliderID; ?> nocolor">
<?php } else { ?>
<div class="elegant_slideshow_image_wrap huge_it_slideshow_image_wrap_<?php echo $sliderID; ?> ">
<?php } ?>
<?php if($sliderloadingicon == "on") { ?>
<div id="huge_it_loading_image_<?php echo $sliderID; ?>" class="display" ><img src="<?php echo plugins_url('', __FILE__).'/Front_images/loading/loading'.$paramssld["loading_icon_type"].'.gif'; ?>"/> </div>
<div class="huge_it_slideshow_image_wrap1_<?php echo $sliderID; ?> nodisplay">
<?php } else { ?>
<div id="huge_it_loading_image_<?php echo $sliderID; ?>" class="nodisplay"> <img src="<?php echo plugins_url('', __FILE__).'/Front_images/loading/loading'.$paramssld["loading_icon_type"].'.gif'; ?>" width="100" height="100" style=" margin: 0px auto;" /> </div>
<div class="huge_it_slideshow_image_wrap1_<?php echo $sliderID; ?>"class="display">
<?php } ?>
<?php
$current_pos = 0;
?>
<!-- ##########################DOTS######################### -->
<div class="elegant_slideshow_dots_container huge_it_slideshow_dots_container_<?php echo $sliderID; ?>">
<div class="elegant_dots_container huge_it_slideshow_dots_thumbnails_<?php echo $sliderID; ?>">
<?php
$current_image_id=0;
$current_pos =0;
$current_key=0;
$stri=0;
foreach ($images as $key => $image_row) {
$imagerowstype=$image_row->sl_type;
if($image_row->sl_type == ''){
$imagerowstype='image';
}
switch($imagerowstype){
case 'image':
if ($image_row->id == $current_image_id) {
$current_pos = $stri;
$current_key = $stri;
}
?>
<div id="huge_it_dots_<?php echo $stri; ?>_<?php echo $sliderID; ?>" class="huge_it_slideshow_dots_<?php echo $sliderID; ?> <?php echo (($key==$current_image_id) ? 'huge_it_slideshow_dots_active_' . $sliderID : 'huge_it_slideshow_dots_deactive_' . $sliderID); ?>" onclick="huge_it_change_image_<?php echo $sliderID; ?>(parseInt(jQuery('#huge_it_current_image_key_<?php echo $sliderID; ?>').val()), '<?php echo $stri; ?>', data_<?php echo $sliderID; ?>,false,true);return false;" image_id="<?php echo $image_row->id; ?>" image_key="<?php echo $stri; ?>"></div>
<?php
$stri++;
break;
case 'video':
if ($image_row->id == $current_image_id) {
$current_pos = $stri;
$current_key = $stri;
}
?>
<div id="huge_it_dots_<?php echo $stri; ?>_<?php echo $sliderID; ?>" class="huge_it_slideshow_dots_<?php echo $sliderID; ?> <?php echo (($key==$current_image_id) ? 'huge_it_slideshow_dots_active_' . $sliderID : 'huge_it_slideshow_dots_deactive_' . $sliderID); ?>" onclick="huge_it_change_image_<?php echo $sliderID; ?>(parseInt(jQuery('#huge_it_current_image_key_<?php echo $sliderID; ?>').val()), '<?php echo $stri; ?>', data_<?php echo $sliderID; ?>,false,true);return false;" image_id="<?php echo $image_row->id; ?>" image_key="<?php echo $stri; ?>"></div>
<?php
$stri++;
break;
case 'last_posts':
foreach($recent_posts as $lkeys => $last_posts){
if($image_row->name == "0"){
if($lkeys < $image_row->sl_url){
if(get_the_post_thumbnail($last_posts["ID"], 'thumbnail') != ''){
$imagethumb = wp_get_attachment_image_src( get_post_thumbnail_id($last_posts["ID"]), 'thumbnail-size', true );
if ($image_row->id == $current_image_id) {
$current_pos = $stri;
$current_key = $stri;
}
?>
<div id="huge_it_dots_<?php echo $stri; ?>_<?php echo $sliderID; ?>" class="huge_it_slideshow_dots_<?php echo $sliderID; ?> <?php echo (($stri==$current_image_id) ? 'huge_it_slideshow_dots_active_' . $sliderID : 'huge_it_slideshow_dots_deactive_' . $sliderID); ?>" onclick="huge_it_change_image_<?php echo $sliderID; ?>(parseInt(jQuery('#huge_it_current_image_key_<?php echo $sliderID; ?>').val()), '<?php echo $stri; ?>', data_<?php echo $sliderID; ?>,false,true);return false;" image_id="<?php echo $image_row->id; ?>" image_key="<?php echo $stri; ?>"></div>
<?php
$stri++;
}
}
}
else{
$category_id = get_cat_ID($image_row->name); // my slider category id
$category_id_from_posts = get_the_category($last_posts['ID']); // recent post id
if($category_id == $category_id_from_posts[0]->term_id){
if($lkeys < $image_row->sl_url){
if(get_the_post_thumbnail($last_posts["ID"], 'thumbnail') != ''){
$imagethumb = wp_get_attachment_image_src( get_post_thumbnail_id($last_posts["ID"]), 'thumbnail-size', true );
if ($image_row->id == $current_image_id) {
$current_pos = $stri;
$current_key = $stri;
}
?>
<div id="huge_it_dots_<?php echo $stri; ?>_<?php echo $sliderID; ?>" class="huge_it_slideshow_dots_<?php echo $sliderID; ?> <?php echo (($stri==$current_image_id) ? 'huge_it_slideshow_dots_active_' . $sliderID : 'huge_it_slideshow_dots_deactive_' . $sliderID); ?>" onclick="huge_it_change_image_<?php echo $sliderID; ?>(parseInt(jQuery('#huge_it_current_image_key_<?php echo $sliderID; ?>').val()), '<?php echo $stri; ?>', data_<?php echo $sliderID; ?>,false,true);return false;" image_id="<?php echo $image_row->id; ?>" image_key="<?php echo $stri; ?>"></div>
<?php
$stri++;
}
}
}
}
}
break;
}
}
?>
</div>
<?php
if ($paramssld['slider_show_arrows']=="on") {
?>
<a class="elegant_slideshow_arrow elegant_left_arrow" id="huge_it_slideshow_left_<?php echo $sliderID; ?>" href="#">
<div id="huge_it_slideshow_left-ico_<?php echo $sliderID; ?>">
<div><i class="huge_it_slideshow_prev_btn_<?php echo $sliderID; ?> fa"></i></div></div>
</a>
<a class="elegant_slideshow_arrow elegant_right_arrow" id="huge_it_slideshow_right_<?php echo $sliderID; ?>" href="#">
<div id="huge_it_slideshow_right-ico_<?php echo $sliderID;?> , data_<?php echo $sliderID;?>">
<div><i class="huge_it_slideshow_next_btn_<?php echo $sliderID; ?> fa"></i></div></div>
</a>
<?php
}
?>
</div>
<!-- ##########################IMAGES######################### -->
<div id="huge_it_slideshow_image_container_<?php echo $sliderID; ?>" style="width: <?=$overflowVisible ? '100%' : $sliderwidth . 'px'?>; height:<?=$sliderheight?>px" class="elegant_slideshow_image_container huge_it_slideshow_image_container_<?php echo $sliderID; ?>">
<div class="elegant_slider huge_it_slider_<?php echo $sliderID; ?>">
<?php
$i=0;
foreach ($images as $key => $image_row) {
$imagerowstype=$image_row->sl_type;
if($image_row->sl_type == ''){
$imagerowstype='image';
}
switch($imagerowstype){
case 'image':
$target="";
?>
<div data-position="<?=$i?>" class="<?= $i == 0 ? 'active' : '' ?> elegant_slider_item huge_it_slideshow_image_item_<?php echo $sliderID; ?>" id="image_id_<?php echo $sliderID.'_'.$i ?>">
<?php
if($image_row->sl_url!="" && $imageLink){
if ($image_row->link_target=="on"){$target='target="_blank'.$image_row->link_target.'"';}
echo '<a href="'.$image_row->sl_url.'" '.$target.'>';
}
elseif($fancybox) {
echo '<a class="fancybox" rel="group" href="' . $image_row->image_url . '" title="' . $image_row->name . '" data-description="' . wpautop($image_row->description) . '">';
}
?>
<img id="huge_it_slideshow_image_<?php echo $sliderID; ?>" class="elegant_slideshow_image huge_it_slideshow_image_<?php echo $sliderID; ?>" src="<?php echo $image_row->image_url; ?>" image_id="<?php echo $image_row->id; ?>" />
<span class="slider_overlay"></span>
<?php
if($image_row->sl_url!="" && $imageLink || $fancybox) {
echo '</a>';
}
?>
<span class="elegant_slideshow_text_wrapper">
<div class="elegant_slideshow_title huge_it_slideshow_title_text_<?php echo $sliderID; ?> <?php if(trim($image_row->name)=="") echo "none"; ?>">
<?php echo $image_row->name; ?>
</div>
<div class="elegant_slideshow_description huge_it_slideshow_description_text_<?php echo $sliderID; ?> <?php if(trim($image_row->description)=="") echo "none"; ?>">
<?php echo $image_row->description; ?>
</div>
</span>
</div>
<?php
$i++;
break;
case 'last_posts':
foreach($recent_posts as $lkeys => $last_posts){
if($image_row->name == "0"){
if($lkeys < $image_row->sl_url){
$imagethumb = wp_get_attachment_image_src( get_post_thumbnail_id($last_posts["ID"]), 'thumbnail-size', true );
if(get_the_post_thumbnail($last_posts["ID"], 'thumbnail') != ''){
$target="";
?>
<li class="huge_it_slideshow_image<?php if ($i != $current_image_id) {$current_key = $key; echo '_second';} ?>_item_<?php echo $sliderID; ?>" id="image_id_<?php echo $sliderID.'_'.$i ?>">
<?php if ($image_row->sl_postlink=="1"){
if ($image_row->link_target=="on"){$target='target="_blank'.$image_row->link_target.'"';}
echo '<a href="'.$last_posts["guid"].'" '.$target.'>';
} ?>
<img id="huge_it_slideshow_image_<?php echo $sliderID; ?>" class="huge_it_slideshow_image_<?php echo $sliderID; ?>" src="<?php echo $imagethumb[0]; ?>" image_id="<?php echo $image_row->id; ?>" />
<?php if($image_row->sl_postlink=="1"){ echo '</a>'; }?>
<div class="huge_it_slideshow_title_text_<?php echo $sliderID; ?> <?php if(trim($last_posts["post_title"])=="") echo "none"; if($image_row->sl_stitle!="1") echo " hidden"; ?>">
<?php echo $last_posts["post_title"]; ?>
</div>
<div class="huge_it_slideshow_description_text_<?php echo $sliderID; ?> <?php if(trim($last_posts["post_content"])=="") echo "none"; if($image_row->sl_sdesc!="1") echo " hidden"; ?>">
<?php
echo substr_replace($last_posts["post_content"], "", $image_row->description); ?>
</div>
</li>
<?php
$i++;
}
}
}
else{
$category_id = get_cat_ID($image_row->name); // my slider category id
$category_id_from_posts = get_the_category($last_posts['ID']); // recent post id
if($category_id == $category_id_from_posts[0]->term_id){
if($lkeys < $image_row->sl_url){
$imagethumb = wp_get_attachment_image_src( get_post_thumbnail_id($last_posts["ID"]), 'thumbnail-size', true );
if(get_the_post_thumbnail($last_posts["ID"], 'thumbnail') != ''){
$target="";
?>
<li class="huge_it_slideshow_image<?php if ($i != $current_image_id) {$current_key = $key; echo '_second';} ?>_item_<?php echo $sliderID; ?>" id="image_id_<?php echo $sliderID.'_'.$i ?>">
<?php if ($image_row->sl_postlink=="1"){
if ($image_row->link_target=="on"){$target='target="_blank'.$image_row->link_target.'"';}
echo '<a href="'.$last_posts["guid"].'" '.$target.'>';
} ?>
<img id="huge_it_slideshow_image_<?php echo $sliderID; ?>" class="huge_it_slideshow_image_<?php echo $sliderID; ?>" src="<?php echo $imagethumb[0]; ?>" image_id="<?php echo $image_row->id; ?>" />
<?php if($image_row->sl_postlink=="1"){ echo '</a>'; }?>
<div class="huge_it_slideshow_title_text_<?php echo $sliderID; ?> <?php if(trim($last_posts["post_title"])=="") echo "none"; if($image_row->sl_stitle!="1") echo " hidden"; ?>">
<?php echo $last_posts["post_title"]; ?>
</div>
<div class="huge_it_slideshow_description_text_<?php echo $sliderID; ?> <?php if(trim($last_posts["post_content"])=="") echo "none"; if($image_row->sl_sdesc!="1") echo " hidden"; ?>">
<?php
echo substr_replace($last_posts["post_content"], "", $image_row->description); ?>
</div>
</li>
<?php
$i++;
}
}
}
}
}
break;
case 'video':
?>
<li class="huge_it_slideshow_image<?php if ($i != $current_image_id) {$current_key = $key; echo '_second';} ?>_item_<?php echo $sliderID; ?>" id="image_id_<?php echo $sliderID.'_'.$i ?>">
<?php
if(strpos($image_row->image_url,'youtube') !== false || strpos($rowimages->image_url,'youtu') !== false){
$video_thumb_url=get_youtube_id_from_url($image_row->image_url);
?>
<div id="video_id_<?php echo $sliderID;?>_<?php echo $key ;?>" class="huge_it_video_frame_<?php echo $sliderID; ?>"></div>
<?php }else {
$vimeo = $image_row->image_url;
$imgid = end(explode( "/", $vimeo ));
?>
<iframe id="player_<?php echo $key ;?>" class="huge_it_video_frame_<?php echo $sliderID; ?>" src="//player.vimeo.com/video/<?php echo $imgid; ?>?api=1&player_id=player_<?php echo $key ;?>&showinfo=0&controls=0" frameborder="0" allowfullscreen></iframe>
<?php } ?>
</li>
<?php
$i++;
break;
}
}
?>
<input type="hidden" id="huge_it_current_image_key_<?php echo $sliderID; ?>" value="0" />
</div>
</div>
</div>
</div>
<?php
return ob_get_clean();
}
?>