本文整理汇总了PHP中UniteWpmlRev类的典型用法代码示例。如果您正苦于以下问题:PHP UniteWpmlRev类的具体用法?PHP UniteWpmlRev怎么用?PHP UniteWpmlRev使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UniteWpmlRev类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addLangFromData
/**
*
* add language (add slide that connected to current slide) from data
*/
private function addLangFromData($data)
{
$sliderID = UniteFunctionsRev::getVal($data, "sliderid");
$slideID = UniteFunctionsRev::getVal($data, "slideid");
$lang = UniteFunctionsRev::getVal($data, "lang");
//duplicate slide
$slider = new RevSlider();
$slider->initByID($sliderID);
$newSlideID = $slider->duplicateSlide($slideID);
//update new slide
$this->initByID($newSlideID);
$arrUpdate = array();
$arrUpdate["lang"] = $lang;
$arrUpdate["parentid"] = $slideID;
$this->updateParamsInDB($arrUpdate);
$urlIcon = UniteWpmlRev::getFlagUrl($lang);
$title = UniteWpmlRev::getLangTitle($lang);
$newSlide = new RevSlide();
$newSlide->initByID($slideID);
$arrLangCodes = $newSlide->getArrChildLangCodes();
$isAll = UniteWpmlRev::isAllLangsInArray($arrLangCodes);
$html = "<li>\n\t\t\t\t\t\t\t\t<img id=\"icon_lang_" . $newSlideID . "\" class=\"icon_slide_lang\" src=\"" . $urlIcon . "\" title=\"" . $title . "\" data-slideid=\"" . $newSlideID . "\" data-lang=\"" . $lang . "\">\n\t\t\t\t\t\t\t\t<div class=\"icon_lang_loader loader_round\" style=\"display:none\"></div>\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t</li>";
$response = array();
$response["operation"] = "add";
$response["isAll"] = $isAll;
$response["html"] = $html;
return $response;
}
示例2: previewOutputMarkup
public function previewOutputMarkup($sliderID, $output = null)
{
if ($sliderID == "empty_output") {
$this->loadingMessageOutput();
exit;
}
if ($output == null) {
$output = new RevSliderOutput();
}
$slider = new RevSlider();
$slider->initByID($sliderID);
$isWpmlExists = UniteWpmlRev::isWpmlExists();
$useWpml = $slider->getParam("use_wpml", "off");
$wpmlActive = false;
if ($isWpmlExists && $useWpml == "on") {
$wpmlActive = true;
$arrLanguages = UniteWpmlRev::getArrLanguages(false);
//set current lang to output
$currentLang = UniteFunctionsRev::getPostGetVariable("lang");
if (empty($currentLang)) {
$currentLang = UniteWpmlRev::getCurrentLang();
}
if (empty($currentLang)) {
$currentLang = $arrLanguages[0];
}
$output->setLang($currentLang);
$selectLangChoose = UniteFunctionsRev::getHTMLSelect($arrLanguages, $currentLang, "id='select_langs'", true);
}
$output->setPreviewMode();
//put the output html
$urlPlugin = "http://yourpluginpath/";
$urlPreviewPattern = UniteBaseClassRev::$url_ajax_actions . "&client_action=preview_slider&only_markup=true&sliderid=" . $sliderID . "&lang=[lang]&nonce=[nonce]";
$nonce = wp_create_nonce("revslider_actions");
$setBase = is_ssl() ? "https://" : "http://";
$f = new ThemePunch_Fonts();
$my_fonts = $f->get_all_fonts();
?>
<html>
<head>
<script type='text/javascript' src='<?php
echo $setBase;
?>
ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'></script>
</head>
<body style="padding:0px;margin:0px;">
<?php
if ($wpmlActive == true) {
?>
<div style="margin-bottom:10px;text-align:center;">
<?php
_e("Choose language", REVSLIDER_TEXTDOMAIN);
?>
: <?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;
});
jQuery('body').on('click', '#rev_replace_images', function(){
var from = jQuery('input[name="orig_image_path"]').val();
var to = jQuery('input[name="replace_image_path"]').val();
jQuery('#rev_script_content').val(jQuery('#rev_script_content').val().replace(from, to));
jQuery('#rev_the_content').val(jQuery('#rev_the_content').val().replace(from, to));
jQuery('#rev_style_content').val(jQuery('#rev_style_content').val().replace(from, to));
jQuery('#rev_head_content').val(jQuery('#rev_head_content').val().replace(from, to));
});
</script>
<?php
}
?>
<?php
//UniteBaseClassRev::$url_plugin
ob_start();
?>
<link rel='stylesheet' href='<?php
echo $urlPlugin;
?>
css/settings.css?rev=<?php
echo GlobalsRevSlider::SLIDER_REVISION;
?>
' type='text/css' media='all' />
<?php
$http = is_ssl() ? 'https' : 'http';
//.........这里部分代码省略.........
示例3: foreach
}
// end permission
?>
<div class="clear"></div>
<?php
if ($showLangs == true) {
?>
<ul class="list_slide_icons">
<?php
foreach ($arrChildLangs as $arrLang) {
$isParent = UniteFunctionsRev::boolToStr($arrLang["isparent"]);
$childSlideID = $arrLang["slideid"];
$lang = $arrLang["lang"];
$urlFlag = UniteWpmlRev::getFlagUrl($lang);
$langTitle = UniteWpmlRev::getLangTitle($lang);
?>
<li>
<img id="icon_lang_<?php
echo $childSlideID;
?>
" class="icon_slide_lang" src="<?php
echo $urlFlag;
?>
" title="<?php
echo $langTitle;
?>
" data-slideid="<?php
echo $childSlideID;
?>
" data-lang="<?php
示例4: array
$arrSlideNames = array();
if (isset($slider) && $slider->isInited()) {
$arrSlideNames = $slider->getArrSlideNames();
}
$slideSettings = new UniteSettingsAdvancedRev();
//title
$params = array("description" => __ug("The title of the slide, will be shown in the slides list.", REVSLIDER_TEXTDOMAIN), "class" => "medium");
$slideSettings->addTextBox("title", __ug("Slide", REVSLIDER_TEXTDOMAIN), __ug("Slide Title", REVSLIDER_TEXTDOMAIN), $params);
//state
$params = array("description" => __ug("The state of the slide. The unpublished slide will be excluded from the slider.", REVSLIDER_TEXTDOMAIN));
$slideSettings->addSelect("state", array("published" => __ug("Published", REVSLIDER_TEXTDOMAIN), "unpublished" => __ug("Unpublished", REVSLIDER_TEXTDOMAIN)), __ug("State", REVSLIDER_TEXTDOMAIN), "published", $params);
if (isset($slider) && $slider->isInited()) {
$isWpmlExists = UniteWpmlRev::isWpmlExists();
$useWpml = $slider->getParam("use_wpml", "off");
if ($isWpmlExists && $useWpml == "on") {
$arrLangs = UniteWpmlRev::getArrLanguages();
$params = array("description" => __ug("The language of the slide (uses WPML plugin).", REVSLIDER_TEXTDOMAIN));
$slideSettings->addSelect("lang", $arrLangs, __ug("Language", REVSLIDER_TEXTDOMAIN), "all", $params);
}
}
$params = array("description" => __ug("If set, slide will be visible after the date is reached", REVSLIDER_TEXTDOMAIN));
$slideSettings->addDatePicker("date_from", "", __ug("Visible from", REVSLIDER_TEXTDOMAIN), $params);
$params = array("description" => __ug("If set, slide will be visible till the date is reached", REVSLIDER_TEXTDOMAIN));
$slideSettings->addDatePicker("date_to", "", __ug("Visible until", REVSLIDER_TEXTDOMAIN), $params);
$slideSettings->addHr("");
//transition
$params = array("description" => __ug("The appearance transitions of this slide.", REVSLIDER_TEXTDOMAIN), "minwidth" => "250px");
$slideSettings->addChecklist("slide_transition", $arrTransitions, __ug("Transitions", REVSLIDER_TEXTDOMAIN), $defaultTransition, $params);
//slot amount
$params = array("description" => __ug("The number of slots or boxes the slide is divided into. If you use boxfade, over 7 slots can be juggy.", REVSLIDER_TEXTDOMAIN), "class" => "small", "datatype" => "number");
$slideSettings->addTextBox("slot_amount", "7", __ug("Slot Amount", REVSLIDER_TEXTDOMAIN), $params);
示例5: putSliderBase
public function putSliderBase($sliderID)
{
try {
self::$sliderSerial++;
$this->slider = new RevSlider();
$this->slider->initByMixed($sliderID);
//modify settings for admin preview mode
if ($this->previewMode == true) {
$this->modifyPreviewModeSettings();
}
//set slider language
$isWpmlExists = UniteWpmlRev::isWpmlExists();
$useWpml = $this->slider->getParam("use_wpml", "off");
if ($isWpmlExists && $useWpml == "on") {
if ($this->previewMode == false) {
$this->sliderLang = UniteFunctionsWPRev::getCurrentLangCode();
}
}
//edit html before slider
$htmlBeforeSlider = "";
if ($this->slider->getParam("load_googlefont", "false") == "true") {
$googleFont = $this->slider->getParam("google_font");
$htmlBeforeSlider = "<link rel='stylesheet' id='rev-google-font' href='http://fonts.googleapis.com/css?family={$googleFont}' type='text/css' media='all' />";
}
//pub js to body handle
if ($this->slider->getParam("js_to_body", "false") == "true") {
$urlIncludeJS = UniteBaseClassRev::$url_plugin . "rs-plugin/js/jquery.themepunch.revolution.min.js";
$htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>";
}
//the initial id can be alias
$sliderID = $this->slider->getID();
$bannerWidth = $this->slider->getParam("width", null, RevSlider::VALIDATE_NUMERIC, "Slider Width");
$bannerHeight = $this->slider->getParam("height", null, RevSlider::VALIDATE_NUMERIC, "Slider Height");
$sliderType = $this->slider->getParam("slider_type");
//set wrapper height
$wrapperHeigh = 0;
$wrapperHeigh += $this->slider->getParam("height");
//add thumb height
if ($this->slider->getParam("navigaion_type") == "thumb") {
$wrapperHeigh += $this->slider->getParam("thumb_height");
}
$this->sliderHtmlID = "rev_slider_" . $sliderID . "_" . self::$sliderSerial;
$this->sliderHtmlID_wrapper = $this->sliderHtmlID . "_wrapper";
$containerStyle = "";
$sliderPosition = $this->slider->getParam("position", "center");
//set position:
if ($sliderType != "fullscreen") {
switch ($sliderPosition) {
case "center":
default:
$containerStyle .= "margin:0px auto;";
break;
case "left":
$containerStyle .= "float:left;";
break;
case "right":
$containerStyle .= "float:right;";
break;
}
}
//add background color
$backgrondColor = trim($this->slider->getParam("background_color"));
if (!empty($backgrondColor)) {
$containerStyle .= "background-color:{$backgrondColor};";
}
//set padding
$containerStyle .= "padding:" . $this->slider->getParam("padding", "0") . "px;";
//set margin:
if ($sliderType != "fullscreen") {
if ($sliderPosition != "center") {
$containerStyle .= "margin-left:" . $this->slider->getParam("margin_left", "0") . "px;";
$containerStyle .= "margin-right:" . $this->slider->getParam("margin_right", "0") . "px;";
}
$containerStyle .= "margin-top:" . $this->slider->getParam("margin_top", "0") . "px;";
$containerStyle .= "margin-bottom:" . $this->slider->getParam("margin_bottom", "0") . "px;";
}
//set height and width:
$bannerStyle = "display:none;";
//add background image (to banner style)
$showBackgroundImage = $this->slider->getParam("show_background_image", "false");
if ($showBackgroundImage == "true") {
$backgroundImage = $this->slider->getParam("background_image");
if (!empty($backgroundImage)) {
$bannerStyle .= "background-image:url({$backgroundImage});background-repeat:no-repeat;";
}
}
//set wrapper and slider class:
$sliderWrapperClass = "rev_slider_wrapper";
$sliderClass = "rev_slider";
$putResponsiveStyles = false;
switch ($sliderType) {
default:
case "fixed":
$bannerStyle .= "height:{$bannerHeight}px;width:{$bannerWidth}px;";
$containerStyle .= "height:{$bannerHeight}px;width:{$bannerWidth}px;";
break;
case "responsitive":
$putResponsiveStyles = true;
break;
case "fullwidth":
//.........这里部分代码省略.........
示例6: putSliderBase
/**
*
* put html slider on the html page.
* @param $data - mixed, can be ID ot Alias.
*/
public function putSliderBase($sliderID)
{
try {
self::$sliderSerial++;
$this->slider = new RevSlider();
$this->slider->initByMixed($sliderID);
// Do not output Slider if we are on mobile
$disable_on_mobile = $this->slider->getParam("disable_on_mobile", "off");
$isMobile = strstr($_SERVER['HTTP_USER_AGENT'], 'Android') || strstr($_SERVER['HTTP_USER_AGENT'], 'webOS') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPod') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPad') ? true : false;
if ($disable_on_mobile == 'on' && $isMobile) {
return false;
}
$show_alternate = $this->slider->getParam("show_alternative_type", "off");
if ($show_alternate == 'mobile' || $show_alternate == 'mobile-ie8') {
if ($isMobile) {
$show_alternate_image = $this->slider->getParam("show_alternate_image", "");
echo '<img class="tp-slider-alternative-image" src="' . $show_alternate_image . '">';
return false;
}
}
$doWrapFromTemplate = false;
if ($this->slider->isSlidesFromPosts() && $this->slider->getParam("slider_template_id", false) !== false) {
//need to use general settings from the Template Slider
$this->slider->initByMixed($this->slider->getParam("slider_template_id", false));
$doWrapFromTemplate = $sliderID;
}
//modify settings for admin preview mode
if ($this->previewMode == true) {
$this->modifyPreviewModeSettings();
}
//set slider language
$isWpmlExists = UniteWpmlRev::isWpmlExists();
$useWpml = $this->slider->getParam("use_wpml", "off");
if ($isWpmlExists && $useWpml == "on") {
if ($this->previewMode == false) {
$this->sliderLang = UniteFunctionsWPRev::getCurrentLangCode();
}
}
//edit html before slider
$htmlBeforeSlider = "";
if ($this->slider->getParam("load_googlefont", "false") == "true") {
$googleFont = $this->slider->getParam("google_font");
if (is_array($googleFont)) {
foreach ($googleFont as $key => $font) {
$htmlBeforeSlider .= RevOperations::getCleanFontImport($font);
}
} else {
$htmlBeforeSlider .= RevOperations::getCleanFontImport($googleFont);
}
}
//pub js to body handle
if ($this->jsToBody == true) {
//$operations = new RevOperations();
//$arrValues = $operations->getGeneralSettingsValues();
$urlIncludeJSTools = GlobalsRevSlider::$url_item_plugin . "js/jquery.themepunch.tools.min.js?rev=" . GlobalsRevSlider::SLIDER_REVISION;
$htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJSTools}'></script>\n";
//$enable_logs = UniteFunctionsRev::getVal($arrValues, "enable_logs",'off');
$enable_logs = "off";
if ($enable_logs == 'on') {
$urlIncludeJS = UniteBaseClassRev::$url_plugin . "rs-plugin/js/jquery.themepunch.enablelog.js?rev=" . GlobalsRevSlider::SLIDER_REVISION;
$htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>";
}
$useHammer = 'on';
if ($useHammer == 'off') {
$urlIncludeJS = GlobalsRevSlider::$url_item_plugin . "js/jquery.themepunch.disablehammer.js?rev=" . GlobalsRevSlider::SLIDER_REVISION;
$htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>\n";
}
$urlIncludeJS = GlobalsRevSlider::$url_item_plugin . "js/jquery.themepunch.revolution.min.js?rev=" . GlobalsRevSlider::SLIDER_REVISION;
$htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>\n";
}
//the initial id can be alias
$sliderID = $this->slider->getID();
$bannerWidth = $this->slider->getParam("width", null, RevSlider::VALIDATE_NUMERIC, "Slider Width");
$bannerHeight = $this->slider->getParam("height", null, RevSlider::VALIDATE_NUMERIC, "Slider Height");
$sliderType = $this->slider->getParam("slider_type");
//set wrapper height
$wrapperHeigh = 0;
$wrapperHeigh += $this->slider->getParam("height");
//add thumb height
if ($this->slider->getParam("navigaion_type") == "thumb") {
$wrapperHeigh += $this->slider->getParam("thumb_height");
}
$this->sliderHtmlID = "rev_slider_" . $sliderID . "_" . self::$sliderSerial;
$this->sliderHtmlID_wrapper = $this->sliderHtmlID . "_wrapper";
$containerStyle = "";
$sliderPosition = $this->slider->getParam("position", "center");
//set position:
if ($sliderType != "fullscreen") {
switch ($sliderPosition) {
case "center":
default:
$containerStyle .= "margin:0px auto;";
break;
case "left":
$containerStyle .= "float:left;";
//.........这里部分代码省略.........
示例7: previewOutput
/**
*
* preview slider output
* if output object is null - create object
*/
public function previewOutput($sliderID, $output = null)
{
if ($sliderID == "empty_output") {
$this->loadingMessageOutput();
exit;
}
if ($output == null) {
$output = new RevSliderOutput();
}
$slider = new RevSlider();
$slider->initByID($sliderID);
$isWpmlExists = UniteWpmlRev::isWpmlExists();
$useWpml = $slider->getParam("use_wpml", "off");
$wpmlActive = false;
if ($isWpmlExists && $useWpml == "on") {
$wpmlActive = true;
$arrLanguages = UniteWpmlRev::getArrLanguages(false);
//set current lang to output
$currentLang = UniteFunctionsRev::getPostGetVariable("lang");
if (empty($currentLang)) {
$currentLang = UniteWpmlRev::getCurrentLang();
}
if (empty($currentLang)) {
$currentLang = $arrLanguages[0];
}
$output->setLang($currentLang);
$selectLangChoose = UniteFunctionsRev::getHTMLSelect($arrLanguages, $currentLang, "id='select_langs'", true);
}
$output->setPreviewMode();
//put the output html
$urlPlugin = RevSliderAdmin::$url_plugin . "rs-plugin/";
$urlPreviewPattern = UniteBaseClassRev::$url_ajax_actions . "&client_action=preview_slider&sliderid=" . $sliderID . "&lang=[lang]&nonce=[nonce]";
$nonce = wp_create_nonce("revslider_actions");
$setBase = is_ssl() ? "https://" : "http://";
?>
<html>
<head>
<link rel='stylesheet' href='<?php
echo $urlPlugin;
?>
css/settings.css?rev=<?php
echo GlobalsRevSlider::SLIDER_REVISION;
?>
' type='text/css' media='all' />
<?php
//check if dynamic-captions.css exists. If not, include captions.php
//if(file_exists(UniteBaseClassRev::$path_plugin."rs-plugin/css/dynamic-captions.css") == false){
?>
<link rel='stylesheet' href='<?php
echo $urlPlugin;
?>
css/captions.php?rev=<?php
echo GlobalsRevSlider::SLIDER_REVISION;
?>
' type='text/css' media='all' />
<?php
/*}else{
?>
<link rel='stylesheet' href='<?php echo $urlPlugin?>css/dynamic-captions.css?rev=<?php echo GlobalsRevSlider::SLIDER_REVISION; ?>' type='text/css' media='all' />
<?php
}*/
$custom_css = RevOperations::getStaticCss();
echo '<style type="text/css">' . $custom_css . '</style>';
/*<!--link rel='stylesheet' href='<?php echo $urlPlugin?>css/static-captions.css?rev=<?php echo GlobalsRevSlider::SLIDER_REVISION; ?>' type='text/css' media='all' /-->*/
?>
<script type='text/javascript' src='<?php
echo $setBase;
?>
ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'></script>
<script type='text/javascript' src='<?php
echo $urlPlugin;
?>
js/jquery.themepunch.plugins.min.js?rev=<?php
echo GlobalsRevSlider::SLIDER_REVISION;
?>
'></script>
<script type='text/javascript' src='<?php
echo $urlPlugin;
?>
js/jquery.themepunch.revolution.min.js?rev=<?php
echo GlobalsRevSlider::SLIDER_REVISION;
?>
'></script>
</head>
<body style="padding:0px;margin:0px;">
<?php
if ($wpmlActive == true) {
?>
<div style="margin-bottom:10px;text-align:center;">
<?php
_e("Choose language", REVSLIDER_TEXTDOMAIN);
?>
: <?php
echo $selectLangChoose;
//.........这里部分代码省略.........
示例8:
$style_wrapper .= "background-image:url('" . $slideBGExternal . "');";
if ($bgFit == 'percentage') {
$style_wrapper .= "background-size: " . $bgFitX . '% ' . $bgFitY . '%;';
} else {
$style_wrapper .= "background-size: " . $bgFit . ";";
}
if ($bgPosition == 'percentage') {
$style_wrapper .= "background-position: " . $bgPositionX . '% ' . $bgPositionY . '%;';
} else {
$style_wrapper .= "background-position: " . $bgPosition . ";";
}
$style_wrapper .= "background-repeat: " . $bgRepeat . ";";
break;
}
$slideTitle = $slide->getParam("title", "Slide");
$slideOrder = $slide->getOrder();
//treat multilanguage
$isWpmlExists = UniteWpmlRev::isWpmlExists();
$useWpml = $slider->getParam("use_wpml", "off");
$wpmlActive = false;
if (!$slide->isStaticSlide()) {
if ($isWpmlExists && $useWpml == "on") {
$wpmlActive = true;
$parentSlide = $slide->getParentSlide();
$arrChildLangs = $parentSlide->getArrChildrenLangs();
}
}
require self::getPathTemplate("slide");
?>
示例9: putSliderBase
public function putSliderBase($sliderID)
{
try {
self::$sliderSerial++;
$this->slider = new RevSlider();
$this->slider->initByMixed($sliderID);
$doWrapFromTemplate = false;
if ($this->slider->isSlidesFromPosts() && $this->slider->getParam("slider_template_id", false) !== false) {
//need to use general settings from the Template Slider
$this->slider->initByMixed($this->slider->getParam("slider_template_id", false));
$doWrapFromTemplate = $sliderID;
}
//modify settings for admin preview mode
if ($this->previewMode == true) {
$this->modifyPreviewModeSettings();
}
//set slider language
$isWpmlExists = UniteWpmlRev::isWpmlExists();
$useWpml = $this->slider->getParam("use_wpml", "off");
if ($isWpmlExists && $useWpml == "on") {
if ($this->previewMode == false) {
$this->sliderLang = UniteFunctionsWPRev::getCurrentLangCode();
}
}
//edit html before slider
$htmlBeforeSlider = "";
if ($this->slider->getParam("load_googlefont", "false") == "true") {
$googleFont = $this->slider->getParam("google_font");
if (is_array($googleFont)) {
foreach ($googleFont as $key => $font) {
$htmlBeforeSlider .= RevOperations::getCleanFontImport($font);
}
} else {
$htmlBeforeSlider .= RevOperations::getCleanFontImport($googleFont);
}
}
//pub js to body handle
if ($this->slider->getParam("js_to_body", "false") == "true") {
$urlIncludeJS = UniteBaseClassRev::$url_plugin . "rs-plugin/js/jquery.themepunch.plugins.min.js?rev=" . GlobalsRevSlider::SLIDER_REVISION;
$htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>";
$urlIncludeJS = UniteBaseClassRev::$url_plugin . "rs-plugin/js/jquery.themepunch.revolution.min.js?rev=" . GlobalsRevSlider::SLIDER_REVISION;
$htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>";
}
//the initial id can be alias
$sliderID = $this->slider->getID();
$bannerWidth = $this->slider->getParam("width", null, RevSlider::VALIDATE_NUMERIC, "Slider Width");
$bannerHeight = $this->slider->getParam("height", null, RevSlider::VALIDATE_NUMERIC, "Slider Height");
$sliderType = $this->slider->getParam("slider_type");
//set wrapper height
$wrapperHeigh = 0;
$wrapperHeigh += $this->slider->getParam("height");
//add thumb height
if ($this->slider->getParam("navigaion_type") == "thumb") {
$wrapperHeigh += $this->slider->getParam("thumb_height");
}
$this->sliderHtmlID = "rev_slider_" . $sliderID . "_" . self::$sliderSerial;
$this->sliderHtmlID_wrapper = $this->sliderHtmlID . "_wrapper";
$containerStyle = "";
$sliderPosition = $this->slider->getParam("position", "center");
//set position:
if ($sliderType != "fullscreen") {
switch ($sliderPosition) {
case "center":
default:
$containerStyle .= "margin:0px auto;";
break;
case "left":
$containerStyle .= "float:left;";
break;
case "right":
$containerStyle .= "float:right;";
break;
}
}
//add background color
$backgrondColor = trim($this->slider->getParam("background_color"));
if (!empty($backgrondColor)) {
$containerStyle .= "background-color:{$backgrondColor};";
}
//set padding
$containerStyle .= "padding:" . $this->slider->getParam("padding", "0") . "px;";
//set margin:
if ($sliderType != "fullscreen") {
if ($sliderPosition != "center") {
$containerStyle .= "margin-left:" . $this->slider->getParam("margin_left", "0") . "px;";
$containerStyle .= "margin-right:" . $this->slider->getParam("margin_right", "0") . "px;";
}
$containerStyle .= "margin-top:" . $this->slider->getParam("margin_top", "0") . "px;";
$containerStyle .= "margin-bottom:" . $this->slider->getParam("margin_bottom", "0") . "px;";
}
//set height and width:
$bannerStyle = "display:none;";
//add background image (to banner style)
$showBackgroundImage = $this->slider->getParam("show_background_image", "false");
if ($showBackgroundImage == "true") {
$backgroundImage = $this->slider->getParam("background_image");
$backgroundFit = $this->slider->getParam("bg_fit", "cover");
$backgroundRepeat = $this->slider->getParam("bg_repeat", "no-repeat");
$backgroundPosition = $this->slider->getParam("bg_position", "center top");
if (!empty($backgroundImage)) {
//.........这里部分代码省略.........
示例10:
$textEdit = ControllerModulerevslideropencart::$lang_var['Edit_Slide'];
$textPreview = ControllerModulerevslideropencart::$lang_var['Preview_Slide'];
$htmlBefore = "";
$htmlBefore .= "<li class='item_operation operation_delete'><a data-operation='delete' href='javascript:void(0)'>" . "\n";
$htmlBefore .= "<img src='" . $urlIconDelete . "'/> " . $textDelete . "\n";
$htmlBefore .= "</a></li>" . "\n";
$htmlBefore .= "<li class='item_operation operation_edit'><a data-operation='edit' href='javascript:void(0)'>" . "\n";
$htmlBefore .= "<img src='" . $urlIconEdit . "'/> " . $textEdit . "\n";
$htmlBefore .= "</a></li>" . "\n";
$htmlBefore .= "<li class='item_operation operation_preview'><a data-operation='preview' href='javascript:void(0)'>" . "\n";
$htmlBefore .= "<img src='" . $urlIconPreview . "'/> " . $textPreview . "\n";
$htmlBefore .= "</a></li>" . "\n";
$htmlBefore .= "<li class='item_operation operation_sap'>" . "\n";
$htmlBefore .= "<div class='float_menu_sap'></div>" . "\n";
$htmlBefore .= "</a></li>" . "\n";
$langFloatMenu = UniteWpmlRev::getLangsWithFlagsHtmlList("id='slides_langs_float' class='slides_langs_float'", $htmlBefore);
}
} else {
//slides from posts
$templateName = "slides_posts";
$sourceType = $slider->getParam("source_type", "posts");
$showSortBy = $sourceType == "posts" ? true : false;
//get button links
$urlNewPost = UniteFunctionsWPRev::getUrlNewPost();
$linkNewPost = UniteFunctionsRev::getHtmlLink($urlNewPost, ControllerModulerevslideropencart::$lang_var['New_Post'], "button_new_post", "button-primary revblue", true);
//get ordering
$arrSortBy = UniteFunctionsWPRev::getArrSortBy();
$sortBy = $slider->getParam("post_sortby", RevSlider::DEFAULT_POST_SORTBY);
$selectSortBy = UniteFunctionsRev::getHTMLSelect($arrSortBy, $sortBy, "id='select_sortby'", true);
}
require self::getPathTemplate($templateName);
示例11: getPostsByCategory
/**
*
* get posts by some category
* could be multiple
*/
public static function getPostsByCategory($catID, $sortBy = self::SORTBY_ID, $direction = self::ORDER_DIRECTION_DESC, $numPosts = -1, $postTypes = "any", $taxonomies = "category", $arrAddition = array())
{
//get post types
if (strpos($postTypes, ",") !== false) {
$postTypes = explode(",", $postTypes);
if (array_search("any", $postTypes) !== false) {
$postTypes = "any";
}
}
if (empty($postTypes)) {
$postTypes = "any";
}
if (strpos($catID, ",") !== false) {
$catID = explode(",", $catID);
} else {
$catID = array($catID);
}
if (UniteWpmlRev::isWpmlExists()) {
//translate categories to languages
$newcat = array();
foreach ($catID as $id) {
$newcat[] = icl_object_id($id, 'category', true);
}
$catID = $newcat;
}
$query = array('order' => $direction, 'posts_per_page' => $numPosts, 'showposts' => $numPosts, 'post_type' => $postTypes);
//add sort by (could be by meta)
if (strpos($sortBy, "meta_num_") === 0) {
$metaKey = str_replace("meta_num_", "", $sortBy);
$query["orderby"] = "meta_value_num";
$query["meta_key"] = $metaKey;
} else {
if (strpos($sortBy, "meta_") === 0) {
$metaKey = str_replace("meta_", "", $sortBy);
$query["orderby"] = "meta_value";
$query["meta_key"] = $metaKey;
} else {
$query["orderby"] = $sortBy;
}
}
//get taxonomies array
$arrTax = array();
if (!empty($taxonomies)) {
$arrTax = explode(",", $taxonomies);
}
if (!empty($taxonomies)) {
$taxQuery = array();
//add taxomonies to the query
if (strpos($taxonomies, ",") !== false) {
//multiple taxomonies
$taxonomies = explode(",", $taxonomies);
foreach ($taxonomies as $taxomony) {
$taxArray = array('taxonomy' => $taxomony, 'field' => 'id', 'terms' => $catID);
$taxQuery[] = $taxArray;
}
} else {
//single taxomony
$taxArray = array('taxonomy' => $taxonomies, 'field' => 'id', 'terms' => $catID);
$taxQuery[] = $taxArray;
}
$taxQuery['relation'] = 'OR';
$query['tax_query'] = $taxQuery;
}
//if exists taxanomies
if (!empty($arrAddition)) {
$query = array_merge($query, $arrAddition);
}
$query = apply_filters('revslider_get_posts', $query);
$objQuery = new WP_Query($query);
$arrPosts = $objQuery->posts;
//dmp($query);dmp("num posts: ".count($arrPosts));exit();
//dmp($arrPost);
foreach ($arrPosts as $key => $post) {
if (method_exists($post, "to_array")) {
$arrPost = $post->to_array();
} else {
$arrPost = (array) $post;
}
$arrPostCats = self::getPostCategories($post, $arrTax);
$arrPost["categories"] = $arrPostCats;
$arrPosts[$key] = $arrPost;
}
return $arrPosts;
}
示例12: updateLangFromData
/**
*
* updatye slide language from data
*/
public function updateLangFromData($data)
{
$slideID = UniteFunctionsRev::getVal($data, "slideid");
$this->initByID($slideID);
$lang = UniteFunctionsRev::getVal($data, "lang");
$arrUpdate = array();
$arrUpdate["lang"] = $lang;
$this->updateParamsInDB($arrUpdate);
$response = array();
$response["url_icon"] = UniteWpmlRev::getFlagUrl($lang);
$response["title"] = UniteWpmlRev::getLangTitle($lang);
return $response;
}
示例13: previewOutput
/**
*
* preview slider output
* if output object is null - create object
*/
public function previewOutput($sliderID, $output = null)
{
if ($sliderID == "empty_output") {
$this->loadingMessageOutput();
exit;
}
if ($output == null) {
$output = new RevSliderOutput();
}
$slider = new RevSlider();
$slider->initByID($sliderID);
$isWpmlExists = UniteWpmlRev::isWpmlExists();
$useWpml = $slider->getParam("use_wpml", "off");
$wpmlActive = false;
if ($isWpmlExists && $useWpml == "on") {
$wpmlActive = true;
$arrLanguages = UniteWpmlRev::getArrLanguages(false);
//set current lang to output
$currentLang = UniteFunctionsRev::getPostGetVariable("lang");
if (empty($currentLang)) {
$currentLang = UniteWpmlRev::getCurrentLang();
}
if (empty($currentLang)) {
$currentLang = $arrLanguages[0];
}
$output->setLang($currentLang);
$selectLangChoose = UniteFunctionsRev::getHTMLSelect($arrLanguages, $currentLang, "id='select_langs'", true);
}
$output->setPreviewMode();
//put the output html
$urlPlugin = RevSliderAdmin::$url_plugin . "rs-plugin/";
$urlPreviewPattern = UniteBaseClassRev::$url_ajax_actions . "&client_action=preview_slider&sliderid={$sliderID}&lang=[lang]";
?>
<html>
<head>
<link rel='stylesheet' href='<?php
echo $urlPlugin;
?>
css/settings.css' type='text/css' media='all' />
<link rel='stylesheet' href='<?php
echo $urlPlugin;
?>
css/captions.css' type='text/css' media='all' />
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'></script>
<script type='text/javascript' src='<?php
echo $urlPlugin;
?>
js/jquery.themepunch.revolution.min.js'></script>
</head>
<body style="padding:0px;margin:0px;">
<?php
if ($wpmlActive == true) {
?>
<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 pattern = g_previewPattern;
var urlPreview = pattern.replace("[lang]",lang);
location.href = urlPreview;
});
</script>
<?php
}
?>
<?php
$output->putSliderBase($sliderID);
?>
</body>
</html>
<?php
exit;
}