本文整理汇总了PHP中UniteFunctionsWPRev::getCurrentLangCode方法的典型用法代码示例。如果您正苦于以下问题:PHP UniteFunctionsWPRev::getCurrentLangCode方法的具体用法?PHP UniteFunctionsWPRev::getCurrentLangCode怎么用?PHP UniteFunctionsWPRev::getCurrentLangCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UniteFunctionsWPRev
的用法示例。
在下文中一共展示了UniteFunctionsWPRev::getCurrentLangCode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;";
//.........这里部分代码省略.........
示例2: 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)) {
//.........这里部分代码省略.........
示例3: 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":
//.........这里部分代码省略.........
示例4: getCurrentLang
/**
*
* get current language
*/
public static function getCurrentLang()
{
self::validateWpmlExists();
$wpml = new SitePress();
if (is_admin()) {
$lang = $wpml->get_default_language();
} else {
$lang = UniteFunctionsWPRev::getCurrentLangCode();
}
return $lang;
}