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
|
<?php
// Get init code foreach($slides['properties']['attrs'] as $key => $val) {
if(is_bool($val)) { $val = $val ? 'true' : 'false'; $init[] = $key.': '.$val; } elseif(is_numeric($val)) { $init[] = $key.': '.$val; } else { $init[] = "$key: '$val'"; } }
// Full-size sliders if( ( !empty($slides['properties']['attrs']['type']) && $slides['properties']['attrs']['type'] === 'fullsize' ) && ( empty($slides['properties']['attrs']['fullSizeMode']) || $slides['properties']['attrs']['fullSizeMode'] !== 'fitheight' ) ) { $init[] = 'height: '.$slides['properties']['props']['height'].''; }
// Popup if( !empty($slides['properties']['attrs']['type']) && $slides['properties']['attrs']['type'] === 'popup' ) { $lsPlugins[] = 'popup'; }
if( ! empty( $lsPlugins ) ) { $lsPlugins = array_unique( $lsPlugins ); sort( $lsPlugins ); $init[] = 'plugins: ' . json_encode( $lsPlugins ); }
if( get_option('ls_suppress_debug_info', false ) ) { $init[] = 'hideWelcomeMessage: true'; }
$separator = apply_filters( 'layerslider_init_props_separator', ', '); $init = implode( $separator, $init );
$lsInit[] = 'var lsjQuery = jQuery;'; $lsInit[] = 'lsjQuery(document).ready(function() {' . NL; $lsInit[] = 'if(typeof lsjQuery.fn.layerSlider == "undefined") {' . NL; $lsInit[] = 'if( window._layerSlider && window._layerSlider.showNotice) { ' . NL; $lsInit[] = 'window._layerSlider.showNotice(\''.$sliderID.'\',\'jquery\');' . NL; $lsInit[] = '}' . NL; $lsInit[] = '} else {' . NL; $lsInit[] = 'lsjQuery("#'.$sliderID.'")'; if( !empty($slides['callbacks']) && is_array($slides['callbacks']) ) { foreach($slides['callbacks'] as $event => $function) { $lsInit[] = '.on(\''.$event.'\', '.stripslashes($function).')'; } } $lsInit[] = '.layerSlider({'.$init.'});' . NL; $lsInit[] = '}' . NL; $lsInit[] = '});' . NL;
|