本文整理汇总了PHP中UniteFunctionsRev::strToBool方法的典型用法代码示例。如果您正苦于以下问题:PHP UniteFunctionsRev::strToBool方法的具体用法?PHP UniteFunctionsRev::strToBool怎么用?PHP UniteFunctionsRev::strToBool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UniteFunctionsRev
的用法示例。
在下文中一共展示了UniteFunctionsRev::strToBool方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSlideFullWidthVideoData
/**
*
* get slide full width video data
*/
private function getSlideFullWidthVideoData(RevSlide $slide)
{
$response = array("found" => false);
//deal full width video:
$enableVideo = $slide->getParam("enable_video", "false");
if ($enableVideo != "true") {
return $response;
}
$videoID = $slide->getParam("video_id", "");
$videoID = trim($videoID);
if (empty($videoID)) {
return $response;
}
$response["found"] = true;
$videoType = is_numeric($videoID) ? "vimeo" : "youtube";
$videoAutoplay = $slide->getParam("video_autoplay");
$response["type"] = $videoType;
$response["videoID"] = $videoID;
$response["autoplay"] = UniteFunctionsRev::strToBool($videoAutoplay);
return $response;
}
示例2: loadXMLFile
public function loadXMLFile($filepath)
{
if (!file_exists($filepath)) {
UniteFunctionsRev::throwError("File: '{$filepath}' not exists!!!");
}
$obj = simplexml_load_file($filepath);
if (empty($obj)) {
UniteFunctionsRev::throwError("Wrong xml file format: {$filepath}");
}
$fieldsets = $obj->fieldset;
if (!@count($obj->fieldset)) {
$fieldsets = array($fieldsets);
}
$this->addSection("Xml Settings");
foreach ($fieldsets as $fieldset) {
//Add Section
$attribs = $fieldset->attributes();
$sapName = (string) UniteFunctionsRev::getVal($attribs, "name");
$sapLabel = (string) UniteFunctionsRev::getVal($attribs, "label");
if ($sapLabel != '' && isset(RevsliderPrestashop::$lang[$sapLabel])) {
$sapLabel = RevsliderPrestashop::$lang[$sapLabel];
}
$sapIcon = (string) UniteFunctionsRev::getVal($attribs, "icon");
UniteFunctionsRev::validateNotEmpty($sapName, "sapName");
UniteFunctionsRev::validateNotEmpty($sapLabel, "sapLabel");
$this->addSap($sapLabel, $sapName, false, $sapIcon);
//--- add fields
$fieldset = (array) $fieldset;
$fields = $fieldset["field"];
if (is_array($fields) == false) {
$fields = array($fields);
}
foreach ($fields as $field) {
$attribs = $field->attributes();
$fieldType = (string) UniteFunctionsRev::getVal($attribs, "type");
$fieldName = (string) UniteFunctionsRev::getVal($attribs, "name");
$fieldLabel = (string) UniteFunctionsRev::getVal($attribs, "label");
if ($fieldLabel != '' && isset(RevsliderPrestashop::$lang[$fieldLabel])) {
$fieldLabel = RevsliderPrestashop::$lang[$fieldLabel];
}
$fieldDefaultValue = (string) UniteFunctionsRev::getVal($attribs, "default");
//all other params will be added to "params array".
$arrMustParams = array("type", "name", "label", "default");
$arrParams = array();
foreach ($attribs as $key => $value) {
$key = (string) $key;
$value = (string) $value;
//skip must params:
if (in_array($key, $arrMustParams)) {
continue;
}
$arrParams[$key] = $value;
}
$options = $this->getOptionsFromXMLField($field, $fieldName);
//validate must fields:
UniteFunctionsRev::validateNotEmpty($fieldType, "type");
//validate name
if ($fieldType != self::TYPE_HR && $fieldType != self::TYPE_CONTROL && $fieldType != "bulk_control_start" && $fieldType != "bulk_control_end") {
UniteFunctionsRev::validateNotEmpty($fieldName, "name");
}
switch ($fieldType) {
case self::TYPE_CHECKBOX:
$fieldDefaultValue = UniteFunctionsRev::strToBool($fieldDefaultValue);
$this->addCheckbox($fieldName, $fieldDefaultValue, $fieldLabel, $arrParams);
break;
case self::TYPE_COLOR:
$this->addColorPicker($fieldName, $fieldDefaultValue, $fieldLabel, $arrParams);
break;
case self::TYPE_HR:
$this->addHr();
break;
case self::TYPE_TEXT:
$this->addTextBox($fieldName, $fieldDefaultValue, $fieldLabel, $arrParams);
break;
case self::TYPE_MULTIPLE_TEXT:
$this->addMultipleTextBox($fieldName, $fieldDefaultValue, $fieldLabel, $arrParams);
break;
case self::TYPE_STATIC_TEXT:
$this->addStaticText($fieldLabel, $fieldName, $arrParams);
break;
case self::TYPE_IMAGE:
$this->addImage($fieldName, $fieldDefaultValue, $fieldLabel, $arrParams);
break;
case self::TYPE_SELECT:
$this->addSelect($fieldName, $options, $fieldLabel, $fieldDefaultValue, $arrParams);
break;
case self::TYPE_CHECKBOX:
$this->addChecklist($fieldName, $options, $fieldLabel, $fieldDefaultValue, $arrParams);
break;
case self::TYPE_RADIO:
$this->addRadio($fieldName, $options, $fieldLabel, $fieldDefaultValue, $arrParams);
break;
case self::TYPE_TEXTAREA:
$this->addTextArea($fieldName, $fieldDefaultValue, $fieldLabel, $arrParams);
break;
case self::TYPE_CUSTOM:
$this->add($fieldName, $fieldDefaultValue, $fieldLabel, self::TYPE_CUSTOM, $arrParams);
break;
case self::TYPE_BUTTON:
$this->addButton($fieldName, $fieldDefaultValue, $arrParams);
//.........这里部分代码省略.........
示例3: putSliderBase
//.........这里部分代码省略.........
$backgroundPosition = $this->slider->getParam("bg_position", "center top");
if (!empty($backgroundImage)) {
$bannerStyle .= "background-image:url({$backgroundImage});background-repeat:" . $backgroundRepeat . ";background-fit:" . $backgroundFit . ";background-position:" . $backgroundPosition . ";";
}
}
//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":
//$containerStyle .= "height:".$bannerHeight."px;";
$putResponsiveStyles = true;
break;
case "fullwidth":
$sliderWrapperClass .= " fullwidthbanner-container";
$sliderClass .= " fullwidthabanner";
$bannerStyle .= "max-height:" . $bannerHeight . "px;height:" . $bannerHeight . "px;";
$containerStyle .= "max-height:" . $bannerHeight . "px;";
break;
case "fullscreen":
//$containerStyle .= "height:".$bannerHeight."px;";
$sliderWrapperClass .= " fullscreen-container";
$sliderClass .= " fullscreenbanner";
break;
}
//handle position behind
$posBehind = $this->slider->getParam("position_behind", "false");
$posBehind = UniteFunctionsRev::strToBool($posBehind);
if ($posBehind == true) {
$containerStyle .= "position:relative;z-index:0;";
}
$htmlTimerBar = "";
$timerBar = $this->slider->getParam("show_timerbar", "top");
if ($timerBar == "true") {
$timerBar = $this->slider->getParam("timebar_position", "top");
}
switch ($timerBar) {
case "top":
$htmlTimerBar = '<div class="tp-bannertimer"></div>';
break;
case "bottom":
$htmlTimerBar = '<div class="tp-bannertimer tp-bottom"></div>';
break;
case "hide":
$htmlTimerBar = '<div class="tp-bannertimer tp-bottom" style="display:none; visibility: hidden !important;"></div>';
break;
}
//check inner / outer border
$paddingType = $this->slider->getParam("padding_type", "outter");
if ($paddingType == "inner") {
$sliderWrapperClass .= " tp_inner_padding";
}
global $revSliderVersion;
echo "<!-- START REVOLUTION SLIDER " . $revSliderVersion . " " . $sliderType . " mode -->\n";
if ($putResponsiveStyles == true) {
$this->putResponsitiveStyles();
}
echo $htmlBeforeSlider . "\n";
echo "<div id=\"";
echo $this->sliderHtmlID_wrapper;
示例4: putCreativeLayer
/**
*
* put creative layer
*/
private function putCreativeLayer(RevSlide $slide)
{
$layers = $slide->getLayers();
if (empty($layers)) {
return false;
}
?>
<?php
foreach ($layers as $layer) {
$type = UniteFunctionsRev::getVal($layer, "type", "text");
//set if video full screen
$isFullWidthVideo = false;
if ($type == "video") {
$videoData = UniteFunctionsRev::getVal($layer, "video_data");
if (!empty($videoData)) {
$videoData = (array) $videoData;
$isFullWidthVideo = UniteFunctionsRev::getVal($videoData, "fullwidth");
$isFullWidthVideo = UniteFunctionsRev::strToBool($isFullWidthVideo);
} else {
$videoData = array();
}
}
$class = UniteFunctionsRev::getVal($layer, "style");
$animation = UniteFunctionsRev::getVal($layer, "animation", "fade");
//set output class:
$outputClass = "tp-caption " . trim($class);
$outputClass = trim($outputClass) . " ";
$outputClass .= trim($animation);
$left = UniteFunctionsRev::getVal($layer, "left", 0);
$top = UniteFunctionsRev::getVal($layer, "top", 0);
$speed = UniteFunctionsRev::getVal($layer, "speed", 300);
$time = UniteFunctionsRev::getVal($layer, "time", 0);
$easing = UniteFunctionsRev::getVal($layer, "easing", "easeOutExpo");
$randomRotate = UniteFunctionsRev::getVal($layer, "random_rotation", "false");
$randomRotate = UniteFunctionsRev::boolToStr($randomRotate);
$text = UniteFunctionsRev::getVal($layer, "text");
$htmlVideoAutoplay = "";
$htmlVideoNextSlide = "";
//set html:
$html = "";
switch ($type) {
default:
case "text":
$html = $text;
$html = do_shortcode($html);
break;
case "image":
$urlImage = UniteFunctionsRev::getVal($layer, "image_url");
$html = '<img src="' . $urlImage . '" alt="' . $text . '">';
$imageLink = UniteFunctionsRev::getVal($layer, "link", "");
if (!empty($imageLink)) {
$openIn = UniteFunctionsRev::getVal($layer, "link_open_in", "same");
$target = "";
if ($openIn == "new") {
$target = ' target="_blank"';
}
$html = '<a href="' . $imageLink . '"' . $target . '>' . $html . '</a>';
}
break;
case "video":
$videoType = trim(UniteFunctionsRev::getVal($layer, "video_type"));
$videoID = trim(UniteFunctionsRev::getVal($layer, "video_id"));
$videoWidth = trim(UniteFunctionsRev::getVal($layer, "video_width"));
$videoHeight = trim(UniteFunctionsRev::getVal($layer, "video_height"));
$videoArgs = trim(UniteFunctionsRev::getVal($layer, "video_args"));
if ($isFullWidthVideo == true) {
$videoWidth = "100%";
$videoHeight = "100%";
}
switch ($videoType) {
case "youtube":
if (empty($videoArgs)) {
$videoArgs = GlobalsRevSlider::DEFAULT_YOUTUBE_ARGUMENTS;
}
$html = "<iframe src='http://www.youtube.com/embed/{$videoID}?{$videoArgs}' width='{$videoWidth}' height='{$videoHeight}' style='width:{$videoWidth}px;height:{$videoHeight}px;'></iframe>";
break;
case "vimeo":
if (empty($videoArgs)) {
$videoArgs = GlobalsRevSlider::DEFAULT_VIMEO_ARGUMENTS;
}
$html = "<iframe src='http://player.vimeo.com/video/{$videoID}?{$videoArgs}' width='{$videoWidth}' height='{$videoHeight}' style='width:{$videoWidth}px;height:{$videoHeight}px;'></iframe>";
break;
case "html5":
$html = $this->getHtml5LayerHtml($videoData);
break;
default:
UniteFunctionsRev::throwError("wrong video type: {$videoType}");
break;
}
//set video autoplay, with backward compatability
if (array_key_exists("autoplay", $videoData)) {
$videoAutoplay = UniteFunctionsRev::getVal($videoData, "autoplay");
} else {
//backword compatability
$videoAutoplay = UniteFunctionsRev::getVal($layer, "video_autoplay");
}
//.........这里部分代码省略.........
示例5: putCreativeLayer
/**
*
* put creative layer
*/
private function putCreativeLayer(RevSlide $slide, $static_slide = false)
{
$layers = $slide->getLayers();
$customAnimations = RevOperations::getCustomAnimations('customin');
//get all custom animations
$customEndAnimations = RevOperations::getCustomAnimations('customout');
//get all custom animations
$startAnimations = RevOperations::getArrAnimations(false);
//only get the standard animations
$endAnimations = RevOperations::getArrEndAnimations(false);
//only get the standard animations
$lazyLoad = $this->slider->getParam("lazy_load", "off");
$isTemplate = $this->slider->getParam("template", "false");
if (empty($layers)) {
return false;
}
$zIndex = 2;
foreach ($layers as $layer) {
$type = UniteFunctionsRev::getVal($layer, "type", "text");
//set if video full screen
$videoclass = '';
$isFullWidthVideo = false;
if ($type == "video") {
$videoclass = ' tp-videolayer';
$videoData = UniteFunctionsRev::getVal($layer, "video_data");
if (!empty($videoData)) {
$videoData = (array) $videoData;
$isFullWidthVideo = UniteFunctionsRev::getVal($videoData, "fullwidth");
$isFullWidthVideo = UniteFunctionsRev::strToBool($isFullWidthVideo);
} else {
$videoData = array();
}
}
$class = UniteFunctionsRev::getVal($layer, "style");
if (trim($class) !== '') {
$this->class_include['.' . trim($class)] = true;
}
//add classname for style inclusion
$animation = UniteFunctionsRev::getVal($layer, "animation", "tp-fade");
if ($animation == "fade") {
$animation = "tp-fade";
}
$customin = '';
if (!array_key_exists($animation, $startAnimations) && array_key_exists($animation, $customAnimations)) {
//if true, add custom animation
$customin .= 'data-customin="';
$animArr = RevOperations::getCustomAnimationByHandle($customAnimations[$animation]);
if ($animArr !== false) {
$customin .= RevOperations::parseCustomAnimationByArray($animArr);
}
$customin .= '"';
$animation = 'customin';
}
if (strpos($animation, 'customin-') !== false || strpos($animation, 'customout-') !== false) {
$animation = "tp-fade";
}
//set output class:
$layer_2d_rotation = intval(UniteFunctionsRev::getVal($layer, "2d_rotation", '0'));
$layer_2d_origin_x = intval(UniteFunctionsRev::getVal($layer, "2d_origin_x", '50'));
$layer_2d_origin_y = intval(UniteFunctionsRev::getVal($layer, "2d_origin_y", '50'));
if ($layer_2d_rotation == 0) {
$outputClass = "tp-caption " . trim($class);
} else {
$outputClass = "tp-caption ";
}
$outputClass = trim($outputClass) . " ";
$outputClass .= trim($animation);
$left = UniteFunctionsRev::getVal($layer, "left", 0);
$top = UniteFunctionsRev::getVal($layer, "top", 0);
$speed = UniteFunctionsRev::getVal($layer, "speed", 300);
$time = UniteFunctionsRev::getVal($layer, "time", 0);
$easing = UniteFunctionsRev::getVal($layer, "easing", "easeOutExpo");
$randomRotate = UniteFunctionsRev::getVal($layer, "random_rotation", "false");
$randomRotate = UniteFunctionsRev::boolToStr($randomRotate);
$splitin = UniteFunctionsRev::getVal($layer, "split", "none");
$splitout = UniteFunctionsRev::getVal($layer, "endsplit", "none");
$elementdelay = intval(UniteFunctionsRev::getVal($layer, "splitdelay", 0));
$endelementdelay = intval(UniteFunctionsRev::getVal($layer, "endsplitdelay", 0));
if ($elementdelay > 0) {
$elementdelay /= 100;
}
if ($endelementdelay > 0) {
$endelementdelay /= 100;
}
$text = UniteFunctionsRev::getVal($layer, "text");
if (function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
//use qTranslate
$text = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($text);
}
$htmlVideoAutoplay = "";
$htmlVideoAutoplayOnlyFirstTime = "";
$htmlVideoNextSlide = "";
$htmlVideoThumbnail = "";
$htmlMute = '';
$htmlCover = '';
$htmlDotted = '';
//.........这里部分代码省略.........
示例6: putCreativeLayer
/**
*
* put creative layer
*/
private function putCreativeLayer(RevSlide $slide)
{
$layers = $slide->getLayers();
$customAnimations = RevOperations::getCustomAnimations('customin');
//get all custom animations
$customEndAnimations = RevOperations::getCustomAnimations('customout');
//get all custom animations
$startAnimations = RevOperations::getArrAnimations(false);
//only get the standard animations
$endAnimations = RevOperations::getArrEndAnimations(false);
//only get the standard animations
$lazyLoad = $this->slider->getParam("lazy_load", "off");
if (empty($layers)) {
return false;
}
$zIndex = 2;
foreach ($layers as $layer) {
$type = UniteFunctionsRev::getVal($layer, "type", "text");
//set if video full screen
$isFullWidthVideo = false;
if ($type == "video") {
$videoData = UniteFunctionsRev::getVal($layer, "video_data");
if (!empty($videoData)) {
$videoData = (array) $videoData;
$isFullWidthVideo = UniteFunctionsRev::getVal($videoData, "fullwidth");
$isFullWidthVideo = UniteFunctionsRev::strToBool($isFullWidthVideo);
} else {
$videoData = array();
}
}
$class = UniteFunctionsRev::getVal($layer, "style");
$animation = UniteFunctionsRev::getVal($layer, "animation", "tp-fade");
if ($animation == "fade") {
$animation = "tp-fade";
}
$customin = '';
if (!array_key_exists($animation, $startAnimations) && array_key_exists($animation, $customAnimations)) {
//if true, add custom animation
$customin .= 'data-customin="';
$animArr = RevOperations::getCustomAnimationByHandle($customAnimations[$animation]);
if ($animArr !== false) {
$customin .= RevOperations::parseCustomAnimationByArray($animArr);
}
$customin .= '"';
$animation = 'customin';
}
if (strpos($animation, 'customin-') !== false || strpos($animation, 'customout-') !== false) {
$animation = "tp-fade";
}
//set output class:
$outputClass = "tp-caption " . trim($class);
$outputClass = trim($outputClass) . " ";
$outputClass .= trim($animation);
$left = UniteFunctionsRev::getVal($layer, "left", 0);
$top = UniteFunctionsRev::getVal($layer, "top", 0);
$speed = UniteFunctionsRev::getVal($layer, "speed", 300);
$time = UniteFunctionsRev::getVal($layer, "time", 0);
$easing = UniteFunctionsRev::getVal($layer, "easing", "easeOutExpo");
$randomRotate = UniteFunctionsRev::getVal($layer, "random_rotation", "false");
$randomRotate = UniteFunctionsRev::boolToStr($randomRotate);
$splitin = UniteFunctionsRev::getVal($layer, "split", "none");
$splitout = UniteFunctionsRev::getVal($layer, "endsplit", "none");
$elementdelay = intval(UniteFunctionsRev::getVal($layer, "splitdelay", 0));
$endelementdelay = intval(UniteFunctionsRev::getVal($layer, "endsplitdelay", 0));
if ($elementdelay > 0) {
$elementdelay /= 100;
}
if ($endelementdelay > 0) {
$endelementdelay /= 100;
}
$text = UniteFunctionsRev::getVal($layer, "text");
$htmlVideoAutoplay = "";
$htmlVideoAutoplayOnlyFirstTime = "";
$htmlVideoNextSlide = "";
$htmlVideoThumbnail = "";
$htmlMute = '';
$htmlCover = '';
$htmlDotted = '';
$htmlRatio = '';
$htmlRewind = '';
$ids = UniteFunctionsRev::getVal($layer, "attrID");
$classes = UniteFunctionsRev::getVal($layer, "attrClasses");
$title = UniteFunctionsRev::getVal($layer, "attrTitle");
$rel = UniteFunctionsRev::getVal($layer, "attrRel");
$ids = $ids != '' ? ' id="' . $ids . '"' : '';
$classes = $classes != '' ? ' ' . $classes : '';
$title = $title != '' ? ' title="' . $title . '"' : '';
$rel = $rel != '' ? ' rel="' . $rel . '"' : '';
$max_width = UniteFunctionsRev::getVal($layer, "max_width", 'auto');
$max_height = UniteFunctionsRev::getVal($layer, "max_height", 'auto');
$white_space = UniteFunctionsRev::getVal($layer, "whitespace", 'nowrap');
$inline_styles = '';
//set html:
$html = "";
switch ($type) {
default:
//.........这里部分代码省略.........
示例7: publishUnpublishItemFromData
/**
*
* publish some item from data
*/
public function publishUnpublishItemFromData($data)
{
$itemID = $data["itemID"];
$isPublished = $data["isPublished"];
$isPublished = UniteFunctionsRev::strToBool($isPublished);
$newState = !$isPublished;
$this->updateItemPublished($itemID, $newState);
return $newState;
}