コード例 #1
0
    public function previewOutput($sliderID, $output = null)
    {
        if ($sliderID == "empty_output") {
            $this->loadingMessageOutput();
            exit;
        }
        if ($output == null) {
            $output = new BannerRotatorOutput();
        }
        $output->setPreviewMode();
        $slider = new BannerRotator();
        $slider->initByID($sliderID);
        $isWpmlExists = UniteWpmlBanner::isWpmlExists();
        $useWpml = $slider->getParam("useWpml", "false");
        $wpmlActive = false;
        if ($isWpmlExists && $useWpml == "true") {
            $wpmlActive = true;
            $arrLanguages = UniteWpmlBanner::getArrLanguages(false);
            //Set current lang to output
            $currentLang = UniteFunctionsBanner::getPostGetVariable("lang");
            if (empty($currentLang)) {
                $currentLang = UniteWpmlBanner::getCurrentLang();
            }
            if (empty($currentLang)) {
                $currentLang = $arrLanguages[0];
            }
            $output->setLang($currentLang);
            $selectLangChoose = UniteFunctionsBanner::getHTMLSelect($arrLanguages, $currentLang, "id='select_langs'", true);
        }
        //Put the output html
        $urlPlugin = BannerRotatorAdmin::$url_plugin;
        $urlPreviewPattern = UniteBaseClassBanner::$url_ajax_actions . "&client_action=preview_slider&sliderid={$sliderID}&lang=[lang]&nonce=[nonce]";
        $nonce = wp_create_nonce("bannerrotator_actions");
        $setBase = is_ssl() ? "https://" : "http://";
        ?>
				<html>
					<head>
						<link rel='stylesheet' href='<?php 
        echo $urlPlugin;
        ?>
css/banner-rotator.css' type='text/css' media='all' />
						<link rel='stylesheet' href='<?php 
        echo $urlPlugin;
        ?>
css/caption.css' type='text/css' media='all' />
						<script type='text/javascript' src='<?php 
        echo $setBase;
        ?>
ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js'></script>
						<script type='text/javascript' src='<?php 
        echo $urlPlugin;
        ?>
js/jquery.flashblue-plugins.js'></script>
						<script type='text/javascript' src='<?php 
        echo $urlPlugin;
        ?>
js/jquery.banner-rotator.js'></script>
					</head>
					<body style="padding:0px;margin:0px;">
						<?php 
        if ($wpmlActive) {
            ?>
							<div style="margin-bottom:10px;text-align:center;">
							<?php 
            _e("Choose language");
            ?>
: <?php 
            echo $selectLangChoose;
            ?>
							</div>
							
							<script type="text/javascript">
								var g_previewPattern = '<?php 
            echo $urlPreviewPattern;
            ?>
';
								jQuery("#select_langs").change(function(){
									var lang = this.value;
									var nonce = "<?php 
            echo $nonce;
            ?>
";
									var pattern = g_previewPattern;
									var urlPreview = pattern.replace("[lang]",lang).replace("[nonce]",nonce);
									location.href = urlPreview;
								});
							</script>
						<?php 
        }
        ?>
						
						<?php 
        $output->putSliderBase($sliderID);
        ?>
					</body>
				</html>
			<?php 
        exit;
    }
コード例 #2
0
$slideSettings->addTextBox("title", __("Slide", BANNERROTATOR_TEXTDOMAIN), __("Slide Title", BANNERROTATOR_TEXTDOMAIN), $params);
//State
$params = array("description" => __("The state of the slide. The unpublished slide will be excluded from the slider.", BANNERROTATOR_TEXTDOMAIN));
$slideSettings->addSelect("state", array("published" => __("Published", BANNERROTATOR_TEXTDOMAIN), "unpublished" => __("Unpublished", BANNERROTATOR_TEXTDOMAIN)), __("State", BANNERROTATOR_TEXTDOMAIN), "published", $params);
//Visible from
$params = array("description" => __("If set, slide will be visible after the date is reached", BANNERROTATOR_TEXTDOMAIN));
$slideSettings->addDatePicker("date_from", "", __("Visible from", BANNERROTATOR_TEXTDOMAIN), $params);
//Visible until
$params = array("description" => __("If set, slide will be visible till the date is reached", BANNERROTATOR_TEXTDOMAIN));
$slideSettings->addDatePicker("date_to", "", __("Visible until", BANNERROTATOR_TEXTDOMAIN), $params);
$slideSettings->addHr("");
//WPML
$isWpmlExists = UniteWpmlBanner::isWpmlExists();
$useWpml = $slider->getParam("useWpml", "false");
if ($isWpmlExists && $useWpml == "true") {
    $arrLangs = UniteWpmlBanner::getArrLanguages();
    $params = array("description" => __("The language of the slide (uses WPML plugin).", BANNERROTATOR_TEXTDOMAIN));
    $slideSettings->addSelect("lang", $arrLangs, __("Language", BANNERROTATOR_TEXTDOMAIN), "all", $params);
}
//Transition
$params = array("description" => "The appearance transition of this slide.");
$slideSettings->addSelect("slide_transition", $arrTransitions, "Transition", "random", $params);
//Delay
$params = array("description" => __("A new delay value for the Slide. If no delay defined per slide, the delay defined via Options (", BANNERROTATOR_TEXTDOMAIN) . $sliderDelay . __("ms) will be used", BANNERROTATOR_TEXTDOMAIN), "class" => "small");
$slideSettings->addTextBox("delay", "", __("Delay", BANNERROTATOR_TEXTDOMAIN), $params);
//Enable link
$slideSettings->addSelect_boolean("enable_link", __("Enable Link", BANNERROTATOR_TEXTDOMAIN), false, __("Enable", BANNERROTATOR_TEXTDOMAIN), __("Disable", BANNERROTATOR_TEXTDOMAIN));
$slideSettings->startBulkControl("enable_link", UniteSettingsBanner::CONTROL_TYPE_SHOW, "true");
//Link type
$slideSettings->addRadio("link_type", array("regular" => __("Regular", BANNERROTATOR_TEXTDOMAIN), "slide" => __("To Slide", BANNERROTATOR_TEXTDOMAIN)), __("Link Type", BANNERROTATOR_TEXTDOMAIN), "regular");
//Link