Пример #1
0
    public function add_custom_navigation_css($slides)
    {
        $rs_nav = new RevSliderNavigation();
        $all_navs = $rs_nav->get_all_navigations();
        $slider_type = $this->slider->getParam('slider-type');
        $enable_arrows = $this->slider->getParam('enable_arrows', 'off');
        $enable_bullets = $this->slider->getParam('enable_bullets', 'off');
        $enable_tabs = $this->slider->getParam('enable_tabs', 'off');
        $enable_thumbnails = $this->slider->getParam('enable_thumbnails', 'off');
        if ($slider_type !== 'hero' && ($enable_arrows == 'on' || $enable_bullets == 'on' || $enable_tabs == 'on' || $enable_thumbnails == 'on')) {
            if (!empty($slides)) {
                foreach ($slides as $slide) {
                    $navigation_arrow_style = $this->slider->getParam('navigation_arrow_style', 'round');
                    $navigation_bullets_style = $this->slider->getParam('navigation_bullets_style', 'round');
                    $tabs_style = $this->slider->getParam('tabs_style', 'round');
                    $thumbnails_style = $this->slider->getParam('thumbnails_style', 'round');
                    if (!empty($all_navs)) {
                        foreach ($all_navs as $cur_nav) {
                            //get modifications out, wrap the class with slide class to be specific
                            if ($enable_arrows == 'on' && $cur_nav['handle'] == $navigation_arrow_style) {
                                $this->rev_custom_navigation_css .= $rs_nav->add_placeholder_sub_modifications($cur_nav['css']['arrows'], $cur_nav['handle'], 'arrows', $cur_nav['settings'], $slide, $this) . "\n";
                            }
                            if ($enable_bullets == 'on' && $cur_nav['handle'] == $navigation_bullets_style) {
                                $this->rev_custom_navigation_css .= $rs_nav->add_placeholder_sub_modifications($cur_nav['css']['bullets'], $cur_nav['handle'], 'bullets', $cur_nav['settings'], $slide, $this) . "\n";
                            }
                            if ($enable_tabs == 'on' && $cur_nav['handle'] == $tabs_style) {
                                $this->rev_custom_navigation_css .= $rs_nav->add_placeholder_sub_modifications($cur_nav['css']['tabs'], $cur_nav['handle'], 'tabs', $cur_nav['settings'], $slide, $this) . "\n";
                            }
                            if ($enable_thumbnails == 'on' && $cur_nav['handle'] == $thumbnails_style) {
                                $this->rev_custom_navigation_css .= $rs_nav->add_placeholder_sub_modifications($cur_nav['css']['thumbs'], $cur_nav['handle'], 'thumbs', $cur_nav['settings'], $slide, $this) . "\n";
                            }
                        }
                    }
                }
                if ($this->markup_export === true) {
                    echo '<!-- STYLE -->';
                }
                if (!is_admin()) {
                    echo '<script>var htmlDiv = document.getElementById("rs-plugin-settings-inline-css"); var htmlDivCss="';
                } else {
                    echo "<style>";
                }
                if (!is_admin()) {
                    echo addslashes(RevSliderCssParser::compress_css($this->rev_custom_navigation_css)) . '";
						if(htmlDiv) {
							htmlDiv.innerHTML = htmlDiv.innerHTML + htmlDivCss;
						}else{
							var htmlDiv = document.createElement("div");
							htmlDiv.innerHTML = "<style>" + htmlDivCss + "</style>";
							document.getElementsByTagName("head")[0].appendChild(htmlDiv.childNodes[0]);
						}
					</script>' . "\n";
                } else {
                    echo $this->rev_custom_navigation_css . '</style>';
                }
                if ($this->markup_export === true) {
                    echo '<!-- /STYLE -->';
                }
            }
        }
    }