本文整理汇总了PHP中UniteFunctionsRev::convertStdClassToArray方法的典型用法代码示例。如果您正苦于以下问题:PHP UniteFunctionsRev::convertStdClassToArray方法的具体用法?PHP UniteFunctionsRev::convertStdClassToArray怎么用?PHP UniteFunctionsRev::convertStdClassToArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UniteFunctionsRev
的用法示例。
在下文中一共展示了UniteFunctionsRev::convertStdClassToArray方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initByData
/**
*
* init slide by db record
*/
public function initByData($record)
{
$this->id = $record["id"];
$this->sliderID = $record["slider_id"];
$this->slideOrder = $record["slide_order"];
$params = $record["params"];
$params = (array) json_decode($params);
$layers = $record["layers"];
$layers = (array) json_decode($layers);
$layers = UniteFunctionsRev::convertStdClassToArray($layers);
//set image path, file and url
$this->imageUrl = UniteFunctionsRev::getVal($params, "image");
UniteFunctionsRev::validateNotEmpty($this->imageUrl, "Image");
$this->imageFilepath = UniteFunctionsWPRev::getImagePathFromURL($this->imageUrl);
$realPath = UniteFunctionsWPRev::getPathContent() . $this->imageFilepath;
if (file_exists($realPath) == false || is_file($realPath) == false) {
$this->imageFilepath = "";
}
$this->imageFilename = basename($this->imageUrl);
$this->params = $params;
$this->arrLayers = $layers;
}
示例2: updateSlideFromData
/**
*
* update slide from data
* @param $data
*/
public function updateSlideFromData($data, $slideSettings)
{
$slideID = UniteFunctionsRev::getVal($data, "slideid");
$this->initByID($slideID);
//treat params
$params = UniteFunctionsRev::getVal($data, "params");
$params = $this->normalizeParams($params);
//modify the values according the settings
$params = $slideSettings->setStoredValues($params);
//preserve old data that not included in the given data
$params = array_merge($this->params, $params);
//treat layers
$layers = UniteFunctionsRev::getVal($data, "layers");
if (gettype($layers) == "string") {
$layersStrip = stripslashes($layers);
$layersDecoded = json_decode($layersStrip);
if (empty($layersDecoded)) {
$layersDecoded = json_decode($layers);
}
$layers = UniteFunctionsRev::convertStdClassToArray($layersDecoded);
}
if (empty($layers) || gettype($layers) != "array") {
$layers = array();
}
$layers = $this->normalizeLayers($layers);
$arrUpdate = array();
$arrUpdate["layers"] = json_encode($layers);
$arrUpdate["params"] = json_encode($params);
$this->db->update(GlobalsRevSlider::$table_slides, $arrUpdate, array("id" => $this->id));
RevOperations::updateDynamicCaptions();
}
示例3: modifySettingsData
private function modifySettingsData($arrSettings)
{
foreach ($arrSettings as $key => $content) {
switch (getType($content)) {
case "string":
//replace the unicode line break (sometimes left after json)
$content = str_replace("u000a", "\n", $content);
$content = str_replace("u000d", "", $content);
break;
case "object":
case "array":
$content = UniteFunctionsRev::convertStdClassToArray($content);
break;
}
$arrSettings[$key] = $content;
}
return $arrSettings;
}
示例4: filterOneSlide
/**
*
* filter the slides for one slide preview
*/
private function filterOneSlide($slides)
{
$oneSlideID = $this->oneSlideData["slideid"];
$oneSlideParams = UniteFunctionsRev::getVal($this->oneSlideData, "params");
$oneSlideLayers = UniteFunctionsRev::getVal($this->oneSlideData, "layers");
if (gettype($oneSlideParams) == "object") {
$oneSlideParams = (array) $oneSlideParams;
}
if (gettype($oneSlideLayers) == "object") {
$oneSlideLayers = (array) $oneSlideLayers;
}
if (!empty($oneSlideLayers)) {
$oneSlideLayers = UniteFunctionsRev::convertStdClassToArray($oneSlideLayers);
}
$newSlides = array();
foreach ($slides as $slide) {
$slideID = $slide->getID();
if ($slideID == $oneSlideID) {
if (!empty($oneSlideParams)) {
$slide->setParams($oneSlideParams);
}
if (!empty($oneSlideLayers)) {
$slide->setLayers($oneSlideLayers);
}
$newSlides[] = $slide;
//add 2 slides
$newSlides[] = $slide;
}
}
return $newSlides;
}
示例5: updateStaticSlideFromData
/**
*
* update slide from data
* @param $data
*/
public function updateStaticSlideFromData($data)
{
$slideID = UniteFunctionsRev::getVal($data, "slideid");
$this->initByStaticID($slideID);
//treat layers
$layers = UniteFunctionsRev::getVal($data, "layers");
if (gettype($layers) == "string") {
$layersStrip = stripslashes($layers);
$layersDecoded = json_decode($layersStrip);
if (empty($layersDecoded)) {
$layersDecoded = json_decode($layers);
}
$layers = UniteFunctionsRev::convertStdClassToArray($layersDecoded);
}
if (empty($layers) || gettype($layers) != "array") {
$layers = array();
}
$layers = $this->normalizeLayers($layers);
$arrUpdate = array();
$arrUpdate["layers"] = json_encode($layers);
$this->db->update(GlobalsRevSlider::$table_static_slides, $arrUpdate, array("id" => $this->id));
RevOperations::updateDynamicCaptions();
}
示例6: updateSlideFromData
/**
*
* update slide from data
* @param $data
*/
public function updateSlideFromData($data)
{
$slideID = UniteFunctionsRev::getVal($data, "slideid");
$this->initByID($slideID);
//treat params
$params = UniteFunctionsRev::getVal($data, "params");
$params = $this->normalizeParams($params);
//treat layers
$layers = UniteFunctionsRev::getVal($data, "layers");
if (gettype($layers) == "string") {
$layers = stripslashes($layers);
$layers = json_decode($layers);
$layers = UniteFunctionsRev::convertStdClassToArray($layers);
}
if (empty($layers) || gettype($layers) != "array") {
$layers = array();
}
$layers = $this->normalizeLayers($layers);
$arrUpdate = array();
$arrUpdate["layers"] = json_encode($layers);
$arrUpdate["params"] = json_encode($params);
$this->db->update(GlobalsRevSlider::$table_slides, $arrUpdate, array("id" => $this->id));
}
示例7: putCreativeLayer
/**
*
* put creative layer
*/
private function putCreativeLayer($slide)
{
$layers = $slide["layers"];
$layers = UniteFunctionsRev::convertStdClassToArray($layers);
if (empty($layers)) {
return false;
}
?>
<?php
foreach ($layers as $layer) {
$type = UniteFunctionsRev::getVal($layer, "type", "text");
$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 = "";
//set html:
//set html:
$html = "";
switch ($type) {
default:
case "text":
$html = $text;
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"));
$linkYoutube = "http://www.youtube.com";
$linkVimeo = "http://player.vimeo.com";
if (JURI::getInstance()->isSSL() == true) {
$linkYoutube = "https://www.youtube.com";
$linkVimeo = "https://player.vimeo.com";
}
switch ($videoType) {
case "youtube":
$html = "<iframe src='{$linkYoutube}/embed/{$videoID}?hd=1&wmode=opaque&controls=1&showinfo=0;rel=0' width='{$videoWidth}' height='{$videoHeight}' style='width:{$videoWidth}px;height:{$videoHeight}px;'></iframe>";
break;
case "vimeo":
$html = "<iframe src='{$linkVimeo}/video/{$videoID}?title=0&byline=0&portrait=0' width='{$videoWidth}' height='{$videoHeight}' style='width:{$videoWidth}px;height:{$videoHeight}px;'></iframe>";
break;
default:
UniteFunctionsRev::throwError("wrong video type: {$videoType}");
break;
}
$videoAutoplay = UniteFunctionsRev::getVal($layer, "video_autoplay");
if ($videoAutoplay == "true") {
$htmlVideoAutoplay = ' data-autoplay="true"';
}
break;
}
//handle end transitions:
$endTime = trim(UniteFunctionsRev::getVal($layer, "endtime"));
$htmlEnd = "";
if (!empty($endTime)) {
$htmlEnd = "data-end=\"{$endTime}\"";
$endSpeed = trim(UniteFunctionsRev::getVal($layer, "endspeed"));
if (!empty($endSpeed)) {
$htmlEnd .= " data-endspeed=\"{$endSpeed}\"";
}
$endEasing = trim(UniteFunctionsRev::getVal($layer, "endeasing"));
if (!empty($endSpeed) && $endEasing != "nothing") {
$htmlEnd .= " data-endeasing=\"{$endEasing}\"";
}
//add animation to class
$endAnimation = trim(UniteFunctionsRev::getVal($layer, "endanimation"));
if (!empty($endAnimation) && $endAnimation != "auto") {
$outputClass .= " " . $endAnimation;
}
}
//slide link
$htmlLink = "";
//.........这里部分代码省略.........
示例8: getCategoriesByIDs
/**
*
* get categories by id's
*/
public static function getCategoriesByIDs($arrIDs, $strTax = null)
{
if (empty($arrIDs)) {
return array();
}
if (is_string($arrIDs)) {
$strIDs = $arrIDs;
} else {
$strIDs = implode(",", $arrIDs);
}
$args = array();
$args["include"] = $strIDs;
if (!empty($strTax)) {
if (is_string($strTax)) {
$strTax = explode(",", $strTax);
}
$args["taxonomy"] = $strTax;
}
$arrCats = get_categories($args);
if (!empty($arrCats)) {
$arrCats = UniteFunctionsRev::convertStdClassToArray($arrCats);
}
return $arrCats;
}
示例9: filterOneSlide
/**
*
* filter the slides for one slide preview
*/
private function filterOneSlide($slides)
{
$oneSlideID = $this->oneSlideData["slideid"];
$oneSlideParams = (array) $this->oneSlideData["params"];
$oneSlideLayers = (array) $this->oneSlideData["layers"];
$oneSlideLayers = UniteFunctionsRev::convertStdClassToArray($oneSlideLayers);
$newSlides = array();
foreach ($slides as $slide) {
$slideID = $slide->getID();
if ($slideID == $oneSlideID) {
$slide->setParams($oneSlideParams);
$slide->setLayers($oneSlideLayers);
$newSlides[] = $slide;
//add 2 slides
$newSlides[] = $slide;
}
}
return $newSlides;
}
示例10: prepareLayersForOutput
/**
*
* get json layers, and return json layers
* build layer image url's
*/
private function prepareLayersForOutput($jsonLayers)
{
$jsonLayers = trim($jsonLayers);
if (empty($jsonLayers)) {
return $jsonLayers;
}
$arrLayers = json_decode($jsonLayers);
$arrLayers = UniteFunctionsRev::convertStdClassToArray($arrLayers);
foreach ($arrLayers as $key => $layer) {
$layer = (array) $layer;
if (isset($layer["image_url"])) {
$arrLayers[$key]["image_url"] = UniteFunctionJoomlaRev::getImageUrl($layer["image_url"]);
}
}
$jsonLayers = json_encode($arrLayers);
return $jsonLayers;
}
示例11: fetchSql
/**
*
* fetch rows from sql query
*/
public function fetchSql($query)
{
$this->jdb->setQuery($query);
//$response = $this->jdb->execute();
$this->checkForErrors("fetch");
$rows = $this->jdb->loadObjectList();
$rows = UniteFunctionsRev::convertStdClassToArray($rows);
return $rows;
}