public function is_in_timeframe(){ $slide = $this->get_slide(); $in = true; if($this->get_preview_mode() === false){ // do only if we are not in preview mode $ts = current_time('timestamp'); //check if date is set $date_from = $slide->get_param(array('publish', 'from'), ''); $date_to = $slide->get_param(array('publish', 'to'), ''); if($date_from != ''){ $date_from = strtotime($date_from); if($ts < $date_from) $in = false; } if($date_to != ''){ $date_to = strtotime($date_to); if($ts > $date_to) $in = false; } } return $in; } /** * Output Inline JS */ public function add_inline_js(){ echo $this->rev_inline_js; } /** * Output revslider_showDoubleJqueryError */ public function add_inline_double_jquery_error(){ global $rs_double_jquery_script; if($rs_double_jquery_script === false){ echo RS_T2.''."\n"; } $rs_double_jquery_script = true; } /** * set the start size of the slider through javascript **/ public function get_html_js_start_size($optFullWidth, $optFullScreen){ $csizes = $this->get_responsive_size($this); $layout = 'auto'; $html = ''; if(!$this->get_markup_export()){ //not needed for html markup export $html .= 'setREVStartSize('; $html .= "{c: '". $this->get_html_id() ."',"; $html .= (isset($csizes['level']) && !empty($csizes['level'])) ? 'rl:['. $csizes['level'] .'],' : ''; $html .= ($csizes['cacheSize'] !== false) ? 'el:['.$csizes['cacheSize'].'],' : ''; $html .= "gw:[". $csizes['width'] ."],"; $html .= "gh:[". $csizes['height'] ."],"; $html .= "layout:'"; $html .= ($optFullScreen == 'on') ? 'fullscreen' : 'fullwidth'; $html .= "',"; if($this->slider->get_param('type', 'standard') !== 'hero'){ $check = array('tab' => 'tabs', 'thumb' => 'thumbs'); $wpd = array('tabs' => 2, 'thumbs' => 10); foreach($check as $nk => $nav){ $do = false; if($this->slider->get_param(array('nav', $nav, 'set'), false) !== true) continue; if($this->slider->get_param(array('nav', $nav, 'innerOuter'), 'inner') === 'outer-vertical'){ $html .= $nk.'w:"'.$this->slider->get_param(array('nav', $nav, 'widthMin'), 100).'",'; $do = true; } if($this->slider->get_param(array('nav', $nav, 'innerOuter'), 'inner') === 'outer-horizontal'){ $wp = intval($this->slider->get_param(array('nav', $nav, 'padding'), $wpd[$nav])); $h = $this->slider->get_param(array('nav', $nav, 'height'), 50); $h = ($wp > 0) ? $h + $wp * 2 : $h; $html .= $nk.'h:"'.$h.'",'; $do = true; } if($do === false) continue; if($this->slider->get_param(array('nav', $nav, 'hideUnder'), false) === false) continue; $html .= $nk.'hide:"'.$this->slider->get_param(array('nav', $nav, 'hideUnderLimit'), 0).'",'; } } if($this->slider->get_param('layouttype') == 'fullscreen'){ $html .= "offsetContainer:'". esc_attr($this->slider->get_param(array('size', 'fullScreenOffsetContainer'), '')) ."',"; $html .= "offset:'". esc_attr($this->slider->get_param(array('size', 'fullScreenOffset'), '')) ."',"; } $mheight = ($this->slider->get_param('layouttype') !== 'fullscreen') ? $this->slider->get_param(array('size', 'minHeight'), 0) : $this->slider->get_param(array('size', 'minHeightFullScreen'), '0'); $mheight = ($mheight == '' || $mheight=="none") ? 0 : $mheight; $html .= 'mh:"'.$mheight.'"'; $html .= '}'; $html .= ');'; } return $html; } /** * put inline error message in a box. * @before: RevSliderOutput::putErrorMessage */ public function print_error_message($message, $open_page = false){ global $rs_slider_serial; $html_id = $this->get_html_id(); $id = ''; $html = ''; if(empty($html_id)){ $html_id = 'rev_slider_error_'.$rs_slider_serial; }else{ $slides = $this->slider->get_slides(); if(!empty($slides)){ foreach($slides as $slide){ $id = $slide->get_id(); break; } } } $url = (empty($html_id) || !is_user_logged_in() || $id === '') ? '' : admin_url('admin.php?page=revslider&view=slide&id='.$id); $page_url = ($open_page === true && is_user_logged_in()) ? get_edit_post_link() : ''; $html .= ($this->rs_module_wrap_open === false) ? RS_T3.''."\n" : ''; $html .= ($this->rs_module_open === false) ? RS_T4.''."\n" : ''; $html .= RS_T5.'
'."\n"; $html .= RS_T6.'
Oops...
'."\n"; $html .= RS_T6.'
'.esc_html($message); $html .= (!empty($url)) ? '
'.__('Please follow this link to edit the Slider:', 'revslider') : ''; $html .= '
'."\n"; $html .= (!empty($url)) ? RS_T6.'Edit Module : "'.$this->slider->get_alias().'"'."\n" : ''; $html .= (!empty($page_url)) ? RS_T6.'Edit Page'."\n" : ''; $html .= RS_T5.'
'."\n"; $html .= ($this->rs_module_wrap_closed === false) ? RS_T4.'
'."\n" : ''; $html .= ($this->rs_module_closed === false) ? RS_T3.'
'."\n" : ''; $html .= RS_T3.''."\n"; echo $html; } /** * add JavaScript **/ private function add_js(){ $html_base_pre = $this->js_get_base_pre(); $html_root = $this->js_get_root(); $html_modal = $this->js_get_modal(); $html_carousel = $this->js_get_carousel(); $html_nav = $this->js_get_navigation(); $html_paralax = $this->js_get_parallax(); $html_scroll = $this->js_get_scrolleffect(); $html_sb_timeline = $this->js_get_scrollbased_timeline(); $html_view_port = $this->js_get_viewport(); $html_fallback = $this->js_get_fallback(); $html_custom_css = $this->js_get_custom_css(); $html_base_post = $this->js_get_base_post(); $html_nav_css = $this->get_navigation_css(); $html_spinner = $this->get_spinner_markup(); $global = $this->get_global_settings(); $js_to_footer = $this->_truefalse($this->get_val($global, array('script', 'footer'), false)); $me = $this->get_markup_export(); //add inline style into the footer if($js_to_footer === true && $this->preview_mode == false && $me == false){ ob_start(); } //echo ($me === true) ? '' : ''; //$this->add_inline_styles(); //ADD SCOPED INLINE STYLES //echo ($me === true) ? '' : ''; echo ($me === true) ? '' : ''; echo $html_base_pre; echo $html_root; echo $html_modal; echo $html_carousel; echo $html_nav; echo $html_paralax; echo $html_scroll; echo $html_sb_timeline; echo $html_view_port; echo $html_fallback; echo $html_base_post; echo $html_custom_css; echo $html_spinner; echo $html_nav_css; echo ($me === true) ? '' : ''; if($js_to_footer === true && $this->preview_mode == false && $me == false){ $js_content = ob_get_contents(); ob_clean(); ob_end_clean(); $this->rev_inline_js = $js_content; add_action('wp_print_footer_scripts', array($this, 'add_inline_js'), 100); } if($me === true){ //for html markup export $this->add_inline_double_jquery_error(); }else{ if(has_action('wp_footer', array($this, 'add_inline_double_jquery_error')) === false){ add_action('wp_footer', array($this, 'add_inline_double_jquery_error')); } } } /** * get the JavaScript Pre **/ public function js_get_base_pre(){ $html = ''; $layout = $this->slider->get_param('layouttype'); $sid = $this->slider->get_id(); $html_id = $this->get_html_id(); $fw = ($layout == 'fullwidth') ? 'on' : 'off'; $fw = ($layout == 'fullscreen') ? 'off' : $fw; $fs = ($layout == 'fullscreen') ? 'on' : 'off'; $html .= RS_T4.''."\n"; return $html; } /** * get the custom js **/ public function js_get_custom_js(){ $html = ''; $js = $this->slider->get_param(array('codes', 'javascript'), ''); if($js === '') return ''; $html .= RS_T7; $html .= str_replace('var counter = {val:doctop};', 'var counter = {val:(window.pageYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0)};', $js); //stripslashes($js)); $html .= "\n"; return $html; } /** * get the custom css **/ public function js_get_custom_css(){ $html = ''; $css = $this->slider->get_param(array('codes', 'css'), ''); if($css === '') return $html; $_css = new RevSliderCssParser(); $markup_export = $this->get_markup_export(); if(!is_admin()){ $html .= RS_T4.'"."\n"; }else{ $html .= ($markup_export === true) ? '' : ''; $html .= RS_T4. ''; $html .= ($markup_export === true) ? '' : ''; } return $html; } /** * get the spinner markup if a spinner was selected **/ public function get_spinner_markup(){ $html = ''; $export = $this->get_markup_export(); $spinner = (string)$this->slider->get_param(array('layout', 'spinner', 'type'), '0'); $color = $this->slider->get_param(array('layout', 'spinner', 'color'), '#FFFFFF'); switch($spinner){ case '1': case '2': if(!is_admin()){ $html .= RS_T4.''."\n"; }else{ $html .= ($export === true) ? '' : ''; $html .= RS_T4.''."\n"; $html .= ($export === true) ? '' : ''; } break; case '3': case '4': if(!is_admin()){ $html .= RS_T4.''."\n"; }else{ $html .= ($export === true) ? '' : ''; $html .= RS_T4.''; $html .= ($export === true) ? '' : ''; } break; case '0': case '5': default: break; } return $html; } /** * get the fallback attibutes **/ public function js_get_fallback(){ $html = ''; $s = $this->slider; //shorten $fb = array(); $dpz = $s->get_param(array('general', 'disablePanZoomMobile'), false); $sii = $s->get_param(array('troubleshooting', 'simplify_ie8_ios4'), true); //was false $dfl = $s->get_param(array('general', 'disableFocusListener'), false); $ihc = $s->get_param(array('troubleshooting', 'ignoreHeightChanges'), false); $apvom = $s->get_param(array('general', 'autoPlayVideoOnMobile'), true); if($dpz !== false) $fb['panZoomDisableOnMobile'] = $dpz; if($sii !== false) $fb['simplifyAll'] = $sii; if($s->get_param('type', 'standard') !== 'hero'){ $nsof = $s->get_param(array('general', 'nextSlideOnFocus'), false); if($nsof !== false) $fb['nextSlideOnWindowFocus'] = $nsof; } if($dfl !== false) $fb['disableFocusListener'] = $dfl; if($ihc !== false){ $ihcul = $s->get_param(array('troubleshooting', 'ignoreHeightChangesUnderLimit'), 0); $fb['ignoreHeightChanges'] = $ihc; if(!in_array($ihcul, array(0, '0', '0px'), true)) $fb['ignoreHeightChangesSize'] = $ihcul; } if($apvom !== false) $fb['allowHTML5AutoPlayOnAndroid'] = $apvom; if(!empty($fb)){ $ff = true; $html .= RS_T8.'fallbacks: {'."\n"; foreach($fb as $k => $v){ $html .= ($ff === true) ? '' : ','."\n"; $html .= RS_T9.$k.':'; $html .= $this->write_js_var($v); $ff = false; } $html .= "\n".RS_T8.'},'."\n"; } return $html; } /** * get the viewport attibutes **/ public function js_get_viewport(){ $html = ''; $s = $this->slider; //shorten $vp = array(); $evp = $s->get_param(array('general', 'slideshow', 'viewPort'), false); if($evp === false) return $html; $vps = $s->get_param(array('general', 'slideshow', 'viewPortStart'), 'wait'); $psh = $s->get_param(array('general', 'slideshow', 'presetSliderHeight'), false); $vpa = $s->get_param(array('general', 'slideshow', 'viewPortArea'), 200); if($this->adv_resp_sizes == true){ $vpa = $this->normalize_device_settings($vpa, $this->enabled_sizes, 'html-array', array(200)); }else{ if(is_array($vpa) || is_object($vpa)) $vpa = $this->get_biggest_device_setting($vpa, $this->enabled_sizes); //vpa was before only on one level, so it can be a string or integer in the past } $vp['enable'] = $evp; if($vps !== 'wait') $vp['outof'] = $vps; if(!in_array($vpa, array(200, '200', '200px'), true)) $vp['visible_area'] = $vpa; if($psh !== false) $vp['presize'] = $psh; if(!empty($vp)){ $ff = true; $html .= RS_T8.'viewPort: {'."\n"; foreach($vp as $k => $v){ $html .= ($ff === true) ? '' : ','."\n"; $html .= RS_T9.$k.':'; $html .= $this->write_js_var($v); $ff = false; } $html .= "\n".RS_T8.'},'."\n"; } return $html; } /** * get the scrolleffect attibutes **/ public function js_get_scrolleffect(){ $html = ''; $s = $this->slider; //shorten $se = array(); $ge = $s->get_param(array('scrolleffects', 'set'), false); if($ge === false) return $html; $fa = $s->get_param(array('scrolleffects', 'setFade'), false); $bl = $s->get_param(array('scrolleffects', 'setBlur'), false); $sgs = $s->get_param(array('scrolleffects', 'setGrayScale'), false); $mb = $s->get_param(array('scrolleffects', 'maxBlur'), 10); $ol = $s->get_param(array('scrolleffects', 'layers'), false); $bg = $s->get_param(array('scrolleffects', 'bg'), false); $d = $s->get_param(array('scrolleffects', 'direction'), 'both'); $mp = $s->get_param(array('scrolleffects', 'multiplicator'), '1.35'); //was 1.3 $mpl = $s->get_param(array('scrolleffects', 'multiplicatorLayers'), '0.5'); //was 1.3 $ti = $s->get_param(array('scrolleffects', 'tilt'), '30'); $dom = $s->get_param(array('scrolleffects', 'disableOnMobile'), true); if($ge !== false) $se['set'] = $ge; if($fa !== false) $se['fade'] = $fa; if($bl !== false) $se['blur'] = $bl; if($sgs !== false) $se['grayscale'] = $sgs; if(!in_array($mb, array(10, '10', '10px'), true)) $se['maxblur'] = $mb; if($ol !== false) $se['layers'] = $ol; if($bg !== false) $se['slide'] = $bg; if($d !== 'both') $se['direction'] = $d; if(!in_array($mp, array(1.35, '1.35'), true)) $se['multiplicator'] = $mp; if(!in_array($mpl, array(0.5, '0.5'), true))$se['multiplicator_layers'] = $mpl; if(!in_array($ti, array(30, '30'), true)) $se['tilt'] = $ti; if($dom !== true) $se['mobile'] = true; if(!empty($se)){ $ff = true; $html .= RS_T8.'scrolleffect: {'."\n"; foreach($se as $k => $v){ $html .= ($ff === true) ? '' : ','."\n"; $html .= RS_T9.$k.':'; $html .= $this->write_js_var($v); $ff = false; } $html .= "\n".RS_T8.'},'."\n"; } return $html; } /** * get the scroll based timeline settings */ public function js_get_scrollbased_timeline(){ $html = ''; $s = $this->slider; //shorten $se = array(); $fa = $s->get_param(array('scrolltimeline', 'set'), false); if($fa === false) return $html; $ol = $s->get_param(array('scrolltimeline', 'layers'), false); $ea = $s->get_param(array('scrolltimeline', 'ease'), 'Linear.easeNone'); $sp = $s->get_param(array('scrolltimeline', 'speed'), 500); $sfix = $s->get_param(array('scrolltimeline', 'fixed'), false); $sfixs = $s->get_param(array('scrolltimeline', 'fixedStart'), 0); $sfixe = $s->get_param(array('scrolltimeline', 'fixedEnd'), 0); $se['set'] = $fa; if($ol !== false) $se['layers'] = $ol; if($ea !== 'Linear.easeNone') $se['ease'] = $ea; if($sp !== 500 && $sp !== '500' && $sp !== '500ms') $se['speed'] = $sp; if($sfix === true){ $se['fixed'] = $sfix; $se['fixStart'] = $sfixs; $se['fixEnd'] = $sfixe; } if(!empty($se)){ $ff = true; $html .= RS_T8.'sbtimeline: {'."\n"; foreach($se as $k => $v){ $html .= ($ff === true) ? '' : ','."\n"; $html .= RS_T9.$k.':'; $html .= $this->write_js_var($v); $ff = false; } $html .= "\n".RS_T8.'},'."\n"; } return $html; } /** * get the carousel attibutes **/ public function js_get_parallax(){ $html = ''; $s = $this->slider; //shorten $p = array(); if($s->get_param(array('parallax', 'set'), false) === false) return $html; $sd = $s->get_param(array('parallax', 'setDDD'), false); $pt = ($sd === true) ? '3D' : $s->get_param(array('parallax', 'mouse', 'type'), 'off'); $pl = array(); for($i = 0; $i <= 15; $i++){ $pl[] = intval($s->get_param(array('parallax', 'levels', $i), ($i + 1) * 5)); } $pl = implode(',', $pl); $or = ($sd === true) ? 'slidercenter' : $s->get_param(array('parallax', 'mouse', 'origo'), 'enterpoint'); $sp = $s->get_param(array('parallax', 'mouse', 'speed'), 400); $dpm = $s->get_param(array('parallax', 'disableOnMobile'), false); $bgs = $s->get_param(array('parallax', 'mouse', 'bgSpeed'), 0); $ls = $s->get_param(array('parallax', 'mouse', 'layersSpeed'), 0); $p['levels'] = '['.$pl.']'; if($pt !== 'off') $p['type'] = $pt; if($or !== 'enterpoint') $p['origo'] = $or; if(!in_array($sp, array(400, '400', '400ms'), true)) $p['speed'] = $sp; if($dpm !== false) $p['disable_onmobile'] = $dpm; if($pt === '3D'){ $sh = $s->get_param(array('parallax', 'ddd', 'shadow'), false); $bgf = $s->get_param(array('parallax', 'ddd', 'BGFreeze'), false); $of = $s->get_param(array('parallax', 'ddd', 'overflow'), false); $lof = $s->get_param(array('parallax', 'ddd', 'layerOverflow'), false); $zc = $s->get_param(array('parallax', 'ddd', 'zCorrection'), 400); if($sh !== false) $p['ddd_shadow'] = $sh; if($bgf !== false) $p['ddd_bgfreeze'] = $bgf; if($of !== false) $p['ddd_overflow'] = ($of === false) ? 'visible' : 'hidden'; if($lof !== false) $p['ddd_layer_overflow'] = $lof; if(!in_array($zc, array(400, '400', '400px'), true)) $p['ddd_z_correction'] = $zc; } if(!in_array($bgs, array(0, '0', '0ms'), true)) $p['speedbg'] = $bgs; if(!in_array($ls, array(0, '0', '0ms'), true)) $p['speedls'] = $ls; if(!empty($p)){ $ff = true; $html .= RS_T8.'parallax: {'."\n"; foreach($p as $k => $v){ $html .= ($ff === true) ? '' : ','."\n"; $html .= RS_T9.$k.':'; $html .= $this->write_js_var($v); $ff = false; } $html .= "\n".RS_T8.'},'."\n"; } return $html; } /** * get the Modal Attributes */ public function js_get_modal() { $html = ''; $s = $this->slider; //shorten if($this->usage !== 'modal') return $html; $cover = $s->get_param(array('modal', 'cover'), true); $bodyclass = $s->get_param(array('modal', 'bodyclass'), ''); $color = $s->get_param(array('modal', 'coverColor'), 'rgba(0,0,0,0.5)'); $h = $s->get_param(array('modal', 'horizontal'), 'center'); $v = $s->get_param(array('modal', 'vertical'), 'middle'); $c['useAsModal'] = true; $c['alias'] = esc_attr($this->slider->get_alias()); if($bodyclass !== '') $c['bodyclass'] = $bodyclass; if($cover !== true) $c['cover'] = $cover; if($color !== 'rgba(0,0,0,0.5)') $c['coverColor'] = $color; if($h !== 'center') $c['horizontal'] = $h; if($v !== 'middle') $c['vertical'] = $v; $ff = true; $html .= RS_T8.'modal: {'."\n"; foreach($c as $k => $v){ $html .= ($ff === true) ? '' : ','."\n"; $html .= RS_T9.$k.':'; $html .= $this->write_js_var($v); $ff = false; } $html .= "\n".RS_T8.'},'."\n"; return $html; } /** * get the carousel attibutes **/ public function js_get_carousel(){ $html = ''; $s = $this->slider; //shorten $s_type = $s->get_param('type', 'standard'); if($s_type !== 'carousel') return $html; $c = array(); $ease = $s->get_param(array('carousel', 'ease'), 'Power3.easeInOut'); $speed = $s->get_param(array('carousel', 'speed'), 800); $sal = $s->get_param(array('carousel', 'showAllLayers'), false); $ha = $s->get_param(array('carousel', 'horizontal'), 'center'); $va = $s->get_param(array('carousel', 'vertical'), 'center'); $in = $s->get_param(array('carousel', 'infinity'), false); $sp = $s->get_param(array('carousel', 'space'), 0); $mvi = $s->get_param(array('carousel', 'maxItems'), 3); $st = $s->get_param(array('carousel', 'stretch'), false); $fo = $s->get_param(array('carousel', 'fadeOut'), true); $cr = $s->get_param(array('carousel', 'rotation'), false); $cs = $s->get_param(array('carousel', 'scale'), false); $br = $s->get_param(array('carousel', 'borderRadius'), 0); $pt = $s->get_param(array('carousel', 'paddingTop'), 0); $pb = $s->get_param(array('carousel', 'paddingBottom'), 0); if($ease !== 'Power3.easeInOut') $c['easing'] = $ease; if(!in_array($speed, array(800, '800', '800ms'), true)) $c['speed'] = $speed; if($sal !== false) $c['showLayersAllTime'] = $sal; if($ha !== 'center') $c['horizontal_align'] = $ha; if($va !== 'center') $c['vertical_align'] = $va; if($in !== false) $c['infinity'] = $in; if(!in_array($sp, array(0, '0', '0px'), true)) $c['space'] = $sp; if(!in_array($mvi, array(3, '3'), true)) $c['maxVisibleItems'] = $mvi; if($st !== false) $c['stretch'] = $st; if($fo !== true) $c['fadeout'] = $fo; if($cr === true){ $mr = $s->get_param(array('carousel', 'maxRotation'), 0); $vr = $s->get_param(array('carousel', 'varyRotate'), false); if(!in_array($mr, array(0, '0', '0deg'), true)) $c['maxRotation'] = $mr; if($vr === true) $c['vary_rotation'] = $vr; } if($cs === true){ $csd = $s->get_param(array('carousel', 'scaleDown'), 50); $csd = ($csd > 100) ? 100 : $csd; $vs = $s->get_param(array('carousel', 'varyScale'), false); if(!in_array($csd, array(50, '50'), true)) $c['minScale'] = $csd; if($vs === true) $c['vary_scale'] = $vs; } if($fo === true){ $vf = $s->get_param(array('carousel', 'varyFade'), false); if($vf !== false) $c['vary_fade'] = $vf; $mo = $s->get_param(array('carousel', 'maxOpacity'), 100); $mo = ($mo > 100) ? 100 : $mo; if(!in_array($mo, array(100, '100'), true)) $c['maxOpacity'] = $csd; } if(!in_array($br, array(0, '0', '0px'), true)) $c['border_radius'] = $br; if(!in_array($pt, array(0, '0', '0px'), true)) $c['padding_top'] = $pt; if(!in_array($pb, array(0, '0', '0px'), true)) $c['padding_bottom'] = $pb; if(!empty($c)){ $ff = true; $html .= RS_T8.'carousel: {'."\n"; foreach($c as $k => $v){ $html .= ($ff === true) ? '' : ','."\n"; $html .= RS_T9.$k.':'; $html .= $this->write_js_var($v); $ff = false; } $html .= "\n".RS_T8.'},'."\n"; } return $html; } /** * get all the basic js keys we need **/ public function js_get_root(){ $html = ''; $s = $this->slider; //shorten $js_loc_r = explode('://', RS_PLUGIN_URL); $global = $this->get_global_settings(); $l_type = $s->get_param('layouttype'); $s_type = $s->get_param('type', 'standard'); $csizes = $this->get_responsive_size($this); $fw = ($l_type == 'fullwidth') ? 'on' : 'off'; $fw = ($l_type == 'fullscreen') ? 'off' : $fw; $fs = ($l_type == 'fullscreen') ? 'on' : 'off'; $layout = 'auto'; if($fs == 'on'){ $layout = 'fullscreen'; }elseif($fw == 'on'){ $layout = 'fullwidth'; } $hsal = str_replace('px', '', $s->get_param(array('visibility', 'hideSliderUnderLimit'), 0)); $hlal = str_replace('px', '', $s->get_param(array('visibility', 'hideSelectedLayersUnderLimit'), 0)); $halul= str_replace('px', '', $s->get_param(array('visibility', 'hideAllLayersUnderLimit'), 0)); if(!empty($hsal)) $hsal++; if(!empty($hlal)) $hlal++; if(!empty($halul)) $halul++; $start_delay = $s->get_param(array('general', 'slideshow', 'initDelay'), '0'); $start_delay = apply_filters('revslider_add_js_delay', $start_delay); $spinner = $s->get_param(array('layout', 'spinner', 'type'), '0'); $spinner = (in_array($spinner, array(-1, '-1'), true)) ? 'off' : $spinner; $keys = array( 'sliderType' => array( 'v' => $s_type, 'd' => 'standard' ), 'jsFileLocation' => array( 'v' => '//'.$js_loc_r[1] .'public/assets/js/', 'd' => '' ), 'sliderLayout' => array( 'v' => $layout, 'd' => 'auto' ), 'dottedOverlay' => array( 'v' => $s->get_param(array('layout', 'bg', 'dottedOverlay'), 'none'), 'd' => 'none' ), 'duration' => array( 'v' => $s->get_param(array('def', 'delay'), '9000'), 'd' => array(9000, '9000', '9000ms') ), 'visibilityLevels' => array( 'v' => ($this->get_val($csizes, 'level', '') !== '') ? $this->get_val($csizes, 'level') : $this->get_val($csizes, 'visibilitylevel'), 'd' => '' ), 'gridwidth' => array( 'v' => $this->get_val($csizes, 'width'), 'd' => '' ), 'gridheight' => array( 'v' => $this->get_val($csizes, 'height'), 'd' => '' ), 'minHeight' => array( 'v' => ($l_type !== 'fullscreen') ? $s->get_param(array('size', 'minHeight'), 0) : $s->get_param(array('size', 'minHeightFullScreen'), 0), 'd' => array(0, '0', '0px') ), 'autoHeight' => array( 'v' => $s->get_param(array('size', 'respectAspectRatio'), false), 'd' => false ), 'hideSliderAtLimit' => array( 'v' => $hsal, 'd' => array(0, '0', '0px') ), 'hideLayerAtLimit' => array( 'v' => $hlal, 'd' => array(0, '0', '0px') ), 'hideAllLayerAtLimit' => array( 'v' => $halul, 'd' => array(0, '0', '0px') ), 'startDelay' => array( 'v' => $start_delay, 'd' => array(0, '0') ), 'lazyType' => array( 'v' => $s->get_param(array('general', 'lazyLoad'), 'none'), 'd' => 'none' ), 'spinner' => array( 'v' => 'spinner'.$spinner, 'd' => 'spinneroff' ), 'fixedOnTop' => array( 'v' => $s->get_param(array('layout', 'position', 'fixedOnTop'), false), 'd' => false ), 'forceOverflow' => array( 'v' => $s->get_param(array('size', 'forceOverflow'), false), 'd' => false ), 'maxHeight' => array( 'v' => $s->get_param(array('size', 'maxHeight'), 'none'), 'd' => array('', 0, '0', 'none') ), 'keepBPHeight' => array( 'v' => $s->get_param(array('size', 'keepBPHeight'), false), 'd' => false ) ); /* * new spinners */ if($spinner !== 'off' && intval($spinner) > 5) { $keys['spinnerclr'] = array( 'v' => $s->get_param(array('layout', 'spinner', 'color'), '#ffffff'), 'd' => '#ffffff' ); } $lazyloaddata = $this->get_val($global, 'lazyloaddata', ''); if($lazyloaddata !== ''){ $keys['lazyloaddata'] = array('v' => $lazyloaddata, 'd' => ''); } $cache_size = $this->slider->get_param(array('size', 'editorCache'), false); if($cache_size !== false){ $keys['editorheight'] = array('v' => implode(',', (array)$cache_size), 'd' => ''); } if($this->get_val($csizes, 'level', '') !== ''){ $keys['responsiveLevels'] = array('v' => $csizes['level'], 'd' => ''); } if($l_type == 'fullscreen'){ $keys['disableForceFullWidth'] = array('v' => $s->get_param(array('size', 'disableForceFullWidth'), false), 'd' => false); $keys['gridEQModule'] = array('v' => $s->get_param(array('size', 'gridEQModule'), false), 'd' => false); $keys['fullScreenOffsetContainer'] = array('v' => $s->get_param(array('size', 'fullScreenOffsetContainer'), ''), 'd' => ''); $keys['fullScreenOffset'] = array('v' => $s->get_param(array('size', 'fullScreenOffset'), ''), 'd' => ''); } if($s->get_param(array('general', 'progressbar', 'set'), true) === false || $s_type === 'hero'){ $keys['disableProgressBar'] = array('v' => 'on', 'd' => 'off'); } if($s_type !== 'hero'){ $stopSlider = $s->get_param(array('general', 'slideshow', 'stopSlider'), false); $loopSingle = $s->get_param(array('general', 'slideshow', 'loopSingle'), true); $stopAtSlide = $s->get_param(array('general', 'slideshow', 'stopAtSlide'), -1); $stopAfterLoops = $s->get_param(array('general', 'slideshow', 'stopAfterLoops'), 0); $slideShow = $s->get_param(array('general', 'slideshow', 'slideShow'), true); if(!$this->get_is_single_slide()){ if($slideShow === false){ $stopAtSlide = 1; $stopAfterLoops = 0; } if($slideShow === true && $stopSlider === false){ $stopAtSlide = -1; $stopAfterLoops = -1; } /*if($slideShow === true && $stopSlider === true){ $stopAtSlide = $stopAtSlide; $stopAfterLoops = $stopAfterLoops; }*/ }else{ if($loopSingle === true){ $stopAtSlide = -1; $stopAfterLoops = -1; } } $keys['stopAtSlide'] = array('v' => $stopAtSlide, 'd' => array(-1, '-1')); $keys['stopAfterLoops'] = array('v' => $stopAfterLoops, 'd' => array(-1, '-1')); $keys['shuffle'] = array('v' => $s->get_param(array('general', 'slideshow', 'shuffle'), false), 'd' => false); } $parallax = $s->get_param(array('parallax', 'set'), false); $parallax_type = $s->get_param(array('parallax', 'mouse', 'type'), 'mouse'); if($s->get_param(array('parallax', 'setDDD'), false) == true){ $parallax_type = '3D'; } if($parallax != true || ($parallax == true && $parallax_type != '3D')){ $keys['shadow'] = array('v' => $s->get_param(array('layout', 'bg', 'shadow'), 0), 'd' => array(0, '0')); } if($s_type !== 'hero'){ $keys['stopLoop'] = array('v' => $s->get_param(array('general', 'slideshow', 'stopSlider'), false), 'd' => false); if($s->get_param(array('general', 'firstSlide', 'alternativeFirstSlideSet'), false) === true) $keys['startWithSlide'] = array('v' => $s->get_start_with_slide_setting(), 'd' => 0); } $keys['waitForInit'] = array('v' => $s->get_param(array('general', 'slideshow', 'waitForInit'), false), 'd' => false); if($this->frontend_action){ $keys['ajaxUrl'] = array('v' => admin_url('admin-ajax.php'), 'd' => ''); $keys['ajaxNonce'] = array('v' => wp_create_nonce('RevSlider_Front'), 'd' => ''); } if(!empty($keys)){ foreach($keys as $k => $v){ if(is_array($v['d'])){ if(in_array($v['v'], $v['d'], true)) continue; }else{ if($v['v'] === $v['d']) continue; } $html .= RS_T8.$k.':'; $html .= $this->write_js_var($v['v']); $html .= ','."\n"; } } return $html; } /** * Generate the Navigation CSS of the chosen Navigations **/ public function get_navigation_css(){ $css = ''; $s = $this->slider; //shorten $lot = $s->get_param('type', 'standard'); $navs = array('arrows', 'bullets', 'tabs', 'thumbs'); $_all_navs = array_merge($navs, array('swipe', 'keyboard', 'mouse')); $found = false; foreach($_all_navs as $nav){ if($s->get_param(array('nav', $nav, 'set'), false) === true){ $found = true; break; } } if($lot === 'hero' || $found === false) return $css; $rs_nav = new RevSliderNavigation(); $all_navs = $rs_nav->get_all_navigations(); foreach($navs as $n){ if($s->get_param(array('nav', $n, 'set'), true) === true){ $nar = $s->get_param(array('nav', $n, 'style'), 'round'); if(!empty($all_navs)){ foreach($all_navs as $cur_nav){ if($cur_nav['id'] == $nar){ $css .= (isset($cur_nav['css'])) ? $rs_nav->add_placeholder_modifications($cur_nav, $s, $this)."\n" : ''; break; } } } } } $html = ''; if(trim($css) !== ''){ $css_class = new RevSliderCssParser(); if(!is_admin()){ $html .= RS_T4.""."\n"; }else{ $me = $this->get_markup_export(); $html .= ($me === true) ? '' : ''; $html .= RS_T4 .''; $html .= ($me === true) ? '' : ''; } } return $html; } /** * Generate the Navigation JavaScript **/ public function js_get_navigation(){ $h = array(); $s = $this->slider; //shorten $lot = $s->get_param('type', 'standard'); $navs = array('arrows', 'bullets', 'tabs', 'thumbs'); $_all_navs = array_merge($navs, array('swipe', 'keyboard', 'mouse')); $found = false; foreach($_all_navs as $nav){ if($s->get_param(array('nav', $nav, 'set'), false) === true){ $found = true; break; } } $msn = $s->get_param(array('nav', 'mouse', 'set'), false); $tod = $s->get_param(array('nav', 'swipe', 'setOnDesktop'), false); if($msn === 'on' || $msn === 'carousel' || $tod === true) $found = true; $h = array(); if($lot === 'hero' || $found === false){ //we still need onHoverStop $ohs = $s->get_param(array('general', 'slideshow', 'stopOnHover'), true); if($ohs === false) $h['onHoverStop'] = false; }else{ $rs_nav = new RevSliderNavigation(); $all_navs = $rs_nav->get_all_navigations(); //KEYBOARD $kbn = $s->get_param(array('nav', 'keyboard', 'set'), false); $kbd = $s->get_param(array('nav', 'keyboard', 'direction'), 'horizontal'); $msr = $s->get_param(array('nav', 'mouse', 'reverse'), false); $ohs = $s->get_param(array('general', 'slideshow', 'stopOnHover'), true); if($kbn === true) $h['keyboardNavigation'] = true; if($kbd !== 'horizontal')$h['keyboard_direction'] = $kbd; if($msn !== 'off') $h['mouseScrollNavigation'] = $msn; if($msr !== 'default') $h['mouseScrollReverse'] = $msr; if($ohs === false) $h['onHoverStop'] = false; //TOUCH $te = ($tod === true) ? true : $s->get_param(array('nav', 'swipe', 'set'), false); if($te === true){ $sth = intval($s->get_param(array('nav', 'swipe', 'velocity'), 75)); $smt = intval($s->get_param(array('nav', 'swipe', 'minTouch'), '1')); $sd = $s->get_param(array('nav', 'swipe', 'direction'), 'horizontal'); $dbv = $s->get_param(array('nav', 'swipe', 'blockDragVertical'), false); $h['touch'] = array(); $h['touch']['touchenabled'] = $te; if($tod === true) $h['touch']['touchOnDesktop'] = true; if($sth !== 75) $h['touch']['swipe_threshold'] = $sth; if($smt !== 1) $h['touch']['swipe_min_touches'] = $smt; if($sd !== 'horizontal') $h['touch']['swipe_direction'] = $sd; if($dbv !== false) $h['touch']['drag_block_vertical'] = $dbv; } //NAVIGATION $defaults = array( 'arrows' => array( 'tmp' => '' ), 'bullets' => array( 'tmp' => '', 'space' => 5 ), 'thumbs' => array( 'tmp' => '', 'space' => 2, 'wrapper_padding' => 2 ), 'tabs' => array( 'tmp' => '', 'space' => 0, 'wrapper_padding' => 10 ) ); foreach($navs as $n){ $as = $s->get_param(array('nav', $n, 'set'), false); if($as === true){ $h[$n] = array(); $h[$n]['enable'] = $as; $nar = $s->get_param(array('nav', $n, 'style'), 'round'); $tmp = ''; if(!empty($all_navs)){ foreach($all_navs as $cur_nav){ if($cur_nav['id'] == $nar){ $nar = $cur_nav['handle']; $tmp = $this->get_val($cur_nav, 'markup', $tmp); break; } } } $tmp = preg_replace("/\r|\n/", "", $tmp); $tmp = str_replace('"', '\\"', $tmp); $hom = $s->get_param(array('nav', $n, 'hideUnder'), false); $ho = $s->get_param(array('nav', $n, 'hideOver'), false); $ao = $s->get_param(array('nav', $n, 'alwaysOn'), true); $anim = $s->get_param(array('nav', $n, 'anim'), 'fade'); $aspeed = $s->get_param(array('nav', $n, 'animSpeed'), '1000ms'); $adelay = $s->get_param(array('nav', $n, 'animDelay'), '1000ms'); $rtl = $s->get_param(array('nav', $n, 'rtl'), false); if($tmp !== $defaults[$n]['tmp']) $h[$n]['tmp'] = $tmp; if($nar !== '') $h[$n]['style'] = $nar; if($hom === true) $h[$n]['hide_onmobile'] = $hom; if($hom === true){ $hu = $s->get_param(array('nav', $n, 'hideUnderLimit'), 0); if(!in_array($hu, array(0, '0', '0px'), true)) $h[$n]['hide_under'] = $hu; } if($ho === true){ $hol = $s->get_param(array('nav', $n, 'hideOverLimit'), 9999); if(!in_array($hol, array(9999, '9999', '9999px'), true)) $h[$n]['hide_over'] = $hol; } if($ao === false) $h[$n]['hide_onleave'] = true; if($ao === false){ $hd = $s->get_param(array('nav', $n, 'hideDelay'), 200); $hdm = $s->get_param(array('nav', $n, 'hideDelayMobile'), 1200); if(!in_array($hd, array(200, '200', '200px'), true)) $h[$n]['hide_delay'] = $hd; if(!in_array($hdm, array(1200, '1200', '1200px'), true)) $h[$n]['hide_delay_mobile'] = $hdm; } if($rtl === true) $h[$n]['rtl'] = true; if($anim !=='fade') $h[$n]['anim'] = $anim; if($aspeed !=='1000ms') $h[$n]['animSpeed'] = $aspeed; if($adelay !=='1000ms') $h[$n]['animDelay'] = $adelay; //left only at arrows if($n === 'arrows'){ $alc = (in_array($s->get_param(array('nav', $n, 'left', 'align'), 'slider'), array('layergrid', 'grid'), true)) ? 'layergrid' : 'slider'; $alha = $s->get_param(array('nav', $n, 'left', 'horizontal'), 'left'); $alva = $s->get_param(array('nav', $n, 'left', 'vertical'), 'center'); $alho = $s->get_param(array('nav', $n, 'left', 'offsetX'), 20); $alvo = $s->get_param(array('nav', $n, 'left', 'offsetY'), 0); $anil = $s->get_param(array('nav', $n, 'left', 'anim'), 'fade'); $arc = (in_array($s->get_param(array('nav', $n, 'right', 'align'), 'slider'), array('layergrid', 'grid'), true)) ? 'layergrid' : 'slider'; $arha = $s->get_param(array('nav', $n, 'right', 'horizontal'), 'right'); $arva = $s->get_param(array('nav', $n, 'right', 'vertical'), 'center'); $arho = $s->get_param(array('nav', $n, 'right', 'offsetX'), 20); $arvo = $s->get_param(array('nav', $n, 'right', 'offsetY'), 0); $anir = $s->get_param(array('nav', $n, 'right', 'anim'), 'fade'); $h[$n]['left'] = array();//left only at arrows $h[$n]['right'] = array(); //right only at arrows if($anil !=='fade') $h[$n]['left']['anim'] = $anil; if($anir !=='fade') $h[$n]['right']['anim'] = $anir; if($alc !== 'slider') $h[$n]['left']['container'] = $alc; if($alha !== 'left') $h[$n]['left']['h_align'] = $alha; if($alva !== 'center') $h[$n]['left']['v_align'] = $alva; if(!in_array($alho, array(20, '20', '20px'), true)) $h[$n]['left']['h_offset'] = intval(str_replace('px', '', $alho)); if(!in_array($alvo, array(0, '0', '0px'), true)) $h[$n]['left']['v_offset'] = intval(str_replace('px', '', $alvo)); if($arc !== 'slider') $h[$n]['right']['container'] = $arc; if($arha !== 'right') $h[$n]['right']['h_align'] = $arha; if($arva !== 'center') $h[$n]['right']['v_align'] = $arva; if(!in_array($arho, array(20, '20', '20px'), true)) $h[$n]['right']['h_offset'] = intval(str_replace('px', '', $arho)); if(!in_array($arvo, array(0, '0', '0px'), true)) $h[$n]['right']['v_offset'] = intval(str_replace('px', '', $arvo)); }else{ //these are not in left/right, but directly added $arha = $s->get_param(array('nav', $n, 'horizontal'), 'center'); $arva = $s->get_param(array('nav', $n, 'vertical'), 'bottom'); $arho = $s->get_param(array('nav', $n, 'offsetX'), 20); $arvo = $s->get_param(array('nav', $n, 'offsetY'), 0); $dir = $s->get_param(array('nav', $n, 'direction'), 'horizontal'); $space = $s->get_param(array('nav', $n, 'space'), $defaults[$n]['space']); if($arha !== 'center') $h[$n]['h_align'] = $arha; if($arva !== 'bottom') $h[$n]['v_align'] = $arva; if(!in_array($arho, array(0, '0', '0px'), true)) $h[$n]['h_offset'] = intval(str_replace('px', '', $arho)); if(!in_array($arvo, array(20, '20', '20px'), true)) $h[$n]['v_offset'] = intval(str_replace('px', '', $arvo)); if($dir !== 'horizontal') $h[$n]['direction'] = $dir; //these exist not in arrows at all if(!in_array($space, array($defaults[$n]['space'], (string)$defaults[$n]['space'], $defaults[$n]['space'].'px'), true)) $h[$n]['space'] = $space; //only exist in thumbs and tabs if(in_array($n, array('thumbs', 'tabs'), true)){ $width = $s->get_param(array('nav', $n, 'width'), 100); $height = $s->get_param(array('nav', $n, 'height'), 50); $mw = $s->get_param(array('nav', $n, 'widthMin'), 100); $wp = $s->get_param(array('nav', $n, 'padding'), $defaults[$n]['wrapper_padding']); $wc = $s->get_param(array('nav', $n, 'wrapperColor'), 'transparent'); $va = $s->get_param(array('nav', $n, 'amount'), 5); $span = $s->get_param(array('nav', $n, 'spanWrapper'), false); $pos = $s->get_param(array('nav', $n, 'innerOuter'), 'inner'); if(!in_array($width, array(100, '100', '100px'), true)) $h[$n]['width'] = $width; if(!in_array($height, array(50, '50', '50px'), true)) $h[$n]['height'] = $height; if(!in_array($mw, array(100, '100', '100px'), true)) $h[$n]['min_width'] = $mw; if(!in_array($wp, array($defaults[$n]['wrapper_padding'], (string)$defaults[$n]['wrapper_padding'], $defaults[$n]['wrapper_padding'].'px'), true)) $h[$n]['wrapper_padding'] = $wp; if(strtolower($wc) !== '#transparent') $h[$n]['wrapper_color'] = $wc; if(!in_array($va, array(5, '5'), true)) $h[$n]['visibleAmount'] = $va; if($span === true) $h[$n]['span'] = $span; if($pos !== 'inner') $h[$n]['position'] = $pos; if($pos === 'inner'){ $arc = (in_array($s->get_param(array('nav', $n, 'align'), 'slider'), array('layergrid', 'grid'), true)) ? 'layergrid' : 'slider'; if($arc !== 'slider') $h[$n]['container'] = $arc; } }else{ //only write in bullets like this $arc = (in_array($s->get_param(array('nav', $n, 'align'), 'slider'), array('layergrid', 'grid'), true)) ? 'layergrid' : 'slider'; if($arc !== 'slider') $h[$n]['container'] = $arc; } } } } } $html = ''; if(!empty($h)){ $html .= RS_T8.'navigation: {'."\n"; $ff = true; foreach($h as $key => $value){ $html .= ($ff === true) ? '' : ','."\n"; if($key == 'thumbs') $key = 'thumbnails'; //change thumb to thumbnail here $html .= RS_T9.$key.':'; if(is_array($value)){ $html .= ' {'."\n"; if(!empty($value)){ $f = true; foreach($value as $k => $v){ $html .= ($f === true) ? '' : ','."\n"; $html .= RS_T10.$k.':'; if(is_array($v)){ $html .= ' {'."\n"; if(!empty($v)){ $fff = true; foreach($v as $kk => $vv){ $html .= ($fff === true) ? '' : ','."\n"; $html .= RS_T11.$kk.':'; $html .= $this->write_js_var($vv); $fff = false; } } $html .= "\n".RS_T10.'}'; }else{ $html .= $this->write_js_var($v); } $f = false; } } $html .= "\n".RS_T9.'}'; }else{ $html .= $this->write_js_var($value); } $ff = false; } $html .= "\n".RS_T8.'},'."\n"; } return $html; } /** * Check if a layer frame is triggered by any other layer * @since: 6.0 **/ public function layer_frame_triggered($uid, $frame){ $ret = false; $uid = (string)$uid; $uid = ($this->is_static) ? 'static-'.$uid : $uid; if($this->is_static){ //we have to push all layers of all slides $layers = array(); $slides = $this->get_current_slides(); $static_slide = $this->get_static_slide(); foreach($slides as $slide){ $slide_layers = $slide->get_layers(); if(!empty($slide_layers)){ foreach($slide_layers as $sl){ $layers[] = $sl; } } } if(!empty($static_slide)){ $slide_layers = $static_slide->get_layers(); if(!empty($slide_layers)){ foreach($slide_layers as $sl){ $this->set_val($sl, 'static_layer', true); $layers[] = $sl; } } } }else{ $layers = $this->get_layers(); } if(empty($layers)) return $ret; foreach($layers as $layer){ $actions = $this->get_val($layer, array('actions', 'action'), array()); if(empty($actions)) continue; $static_layer = $this->get_val($layer, 'static_layer', false); foreach($actions as $action){ $layer_target = (string)$this->get_val($action, 'layer_target', ''); $layer_target = ($static_layer === true) ? 'static-'.$layer_target : $layer_target; if($layer_target !== $uid) continue; $act = $this->get_val($action, 'action', ''); if($act === 'next_frame' || $act === 'prev_frame'){ $ret = true; }elseif($act === 'start_frame' && $frame == $this->get_val($action, 'gotoframe', '')){ $ret = true; }elseif($act === 'start_in' && $frame === 'frame_1'){ $ret = true; }elseif($act === 'start_out' && $frame === 'frame_999'){ $ret = true; }elseif($act === 'toggle_layer' && in_array($frame, array('frame_1', 'frame_999'))){ $ret = true; }elseif($act === 'toggle_frames' && ($frame == $this->get_val($action, 'gotoframeM', '') || $frame == $this->get_val($action, 'gotoframeN', ''))){ $ret = true; } if($ret === true) break; } } return $ret; } /** * Check if shortcodes exists in the content * @since: 5.0 */ public static function check_for_shortcodes($mid_content){ if($mid_content !== null){ if(has_shortcode($mid_content, 'gallery')){ preg_match('/\[gallery.*ids=.(.*).\]/', $mid_content, $img_ids); if(isset($img_ids[1])){ if($img_ids[1] !== '') return explode(',', $img_ids[1]); } } } return false; } /** * return the responsive sizes * @since: 5.0 **/ public function get_responsive_size($slider){ $global = $this->get_global_settings(); $csn = $slider->slider->get_param(array('size', 'custom', 'n'), false); $cst = $slider->slider->get_param(array('size', 'custom', 't'), false); $csi = $slider->slider->get_param(array('size', 'custom', 'm'), false); $w = $slider->slider->get_param(array('size', 'width', 'd'), 1240); $h = $slider->slider->get_param(array('size', 'height', 'd'), 1240); $r = $this->get_val($global, array('size', 'desktop'), 1240); $c = $this->slider->get_param(array('size', 'editorCache', 'd'), false); if($csn == true || $cst == true || $csi == true){ $d = $w; $w .= ','; $w .= ($csn == true) ? $slider->slider->get_param(array('size', 'width', 'n'), 1024) : $d; $d = ($csn == true) ? $slider->slider->get_param(array('size', 'width', 'n'), 1024) : $d; $w .= ','; $w .= ($cst == true) ? $slider->slider->get_param(array('size', 'width', 't'), 778) : $d; $d = ($cst == true) ? $slider->slider->get_param(array('size', 'width', 't'), 778) : $d; $w .= ','; $w .= ($csi == true) ? $slider->slider->get_param(array('size', 'width', 'm'), 480) : $d; $d = ($csi == true) ? $slider->slider->get_param(array('size', 'width', 'm'), 480) : $d; $d = $h; $h .= ','; $h .= ($csn == true) ? $slider->slider->get_param(array('size', 'height', 'n'), 1024) : $d; $d = ($csn == true) ? $slider->slider->get_param(array('size', 'height', 'n'), 1024) : $d; $h .= ','; $h .= ($cst == true) ? $slider->slider->get_param(array('size', 'height', 't'), 778) : $d; $d = ($cst == true) ? $slider->slider->get_param(array('size', 'height', 't'), 778) : $d; $h .= ','; $h .= ($csi == true) ? $slider->slider->get_param(array('size', 'height', 'm'), 480) : $d; $d = ($csi == true) ? $slider->slider->get_param(array('size', 'height', 'm'), 480) : $d; $d = $r; $r .= ','; $r .= ($csn == true) ? $this->get_val($global, array('size', 'notebook'), 1024) : $d; $d = ($csn == true) ? $this->get_val($global, array('size', 'notebook'), 1024) : $d; $r.= ','; $r .= ($cst == true) ? $this->get_val($global, array('size', 'tablet'), 778) : $d; $d = ($cst == true) ? $this->get_val($global, array('size', 'tablet'), 778) : $d; $r.= ','; $r .= ($csi == true) ? $this->get_val($global, array('size', 'mobile'), 480) : $d; $d = ($csi == true) ? $this->get_val($global, array('size', 'mobile'), 480) : $d; if($c !== false){ $d = $c; $c .= ','; $c .= ($csn == true) ? $slider->slider->get_param(array('size', 'editorCache', 'n'), 1024) : $d; $d = ($csn == true) ? $slider->slider->get_param(array('size', 'editorCache', 'n'), 1024) : $d; $c .= ','; $c .= ($cst == true) ? $slider->slider->get_param(array('size', 'editorCache', 't'), 778) : $d; $d = ($cst == true) ? $slider->slider->get_param(array('size', 'editorCache', 't'), 778) : $d; $c .= ','; $c .= ($csi == true) ? $slider->slider->get_param(array('size', 'editorCache', 'm'), 480) : $d; $d = ($csi == true) ? $slider->slider->get_param(array('size', 'editorCache', 'm'), 480) : $d; } }else{ $r .= ','; $r .= $this->get_val($global, array('size', 'notebook'), 1024); $r .= ','; $r .= $this->get_val($global, array('size', 'tablet'), 778); $r .= ','; $r .= $this->get_val($global, array('size', 'mobile'), 480); } return array( 'level' => str_replace('px', '', $r), 'height' => str_replace('px', '', $h), 'width' => str_replace('px', '', $w), 'cacheSize' => str_replace('px', '', $c) ); } /** * strip suffixes from number values for accurate comparisons * @since: 6.0 */ public function strip_suffix_val($val){ if(!is_string($val)) return $val; $val = trim($val); $len = strlen($val); if($len < 2) return $val; $suffix = false; $strips = array('ms', 'px', '%', 'deg'); foreach($strips as $px){ $chars = strlen($px); if($chars > $len) continue; if(strpos($val, $px, $len - $chars) !== false){ $suffix = $chars; break; } } if($suffix !== false){ $num = substr($val, 0, -$suffix); if(is_numeric($num)) $val = $num; } return $val; } /** * strip suffixes from number values for accurate comparisons * @since: 6.0 */ public function strip_suffix($val){ if(is_object($val)) $val = (array)$val; if(is_array($val)){ foreach($val as $key => $v){ if(is_array($v) || is_object($v)){ $val[$key] = $this->strip_suffix($v); }else{ $val[$key] = $this->strip_suffix_val($v); } } }else{ $val = $this->strip_suffix_val($val); } return $val; } /** * shortden values for output * @since: 6.0.0 **/ public function shorten($s, $f, $t){ return str_replace($f, $t, $s); } /** * perform checks to see how to write a JavaScript variable **/ public function write_js_var($v, $pp = '"'){ if(is_bool($v)) $v = ($v) ? 'true' : 'false'; return (is_numeric($v) || substr($v, 0, 1) === '[' || in_array($v, array('true', 'false'))) ? $v : $pp.$v.$pp; } } Goals101 | Intelligent Banking