本文整理汇总了PHP中UniteFunctionsRev::assocToArray方法的典型用法代码示例。如果您正苦于以下问题:PHP UniteFunctionsRev::assocToArray方法的具体用法?PHP UniteFunctionsRev::assocToArray怎么用?PHP UniteFunctionsRev::assocToArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UniteFunctionsRev
的用法示例。
在下文中一共展示了UniteFunctionsRev::assocToArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSlidesFromPosts
/**
*
* get slides from posts
*/
private function getSlidesFromPosts($publishedOnly = false)
{
$slideTemplates = $this->getSlideTemplates();
$slideTemplates = UniteFunctionsRev::assocToArray($slideTemplates);
if (count($slideTemplates) == 0) {
return array();
}
$sourceType = $this->getParam("source_type", "gallery");
switch ($sourceType) {
case "posts":
$arrPosts = $this->getPostsFromCategoies($publishedOnly);
break;
case "specific_posts":
$arrPosts = $this->getPostsFromSpecificList();
break;
default:
UniteFunctionsRev::throwError("getSlidesFromPosts error: This source type must be from posts.");
break;
}
$arrSlides = array();
$templateKey = 0;
$numTemplates = count($slideTemplates);
$slideTemplate = $slideTemplates[$templateKey];
foreach ($arrPosts as $postData) {
//advance the templates
$templateKey++;
if ($templateKey == $numTemplates) {
$templateKey = 0;
}
$slide = new RevSlide();
$slide->initByPostData($postData, $slideTemplate, $this->id);
$arrSlides[] = $slide;
}
$this->arrSlides = $arrSlides;
return $arrSlides;
}