本文整理汇总了PHP中RevSlider::isFavorite方法的典型用法代码示例。如果您正苦于以下问题:PHP RevSlider::isFavorite方法的具体用法?PHP RevSlider::isFavorite怎么用?PHP RevSlider::isFavorite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RevSlider
的用法示例。
在下文中一共展示了RevSlider::isFavorite方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getArrSliders
/**
* get sliders array - function don't belong to the object!
*/
public function getArrSliders($orders = false, $templates = 'neither')
{
$order_fav = false;
if ($orders !== false && key($orders) != 'favorite') {
$order_direction = reset($orders);
$do_order = key($orders);
} else {
$do_order = 'id';
$order_direction = 'ASC';
if (is_array($orders) && key($orders) == 'favorite') {
$order_direction = reset($orders);
$order_fav = true;
}
}
$where = "`type` != 'template'";
$response = $this->db->fetch(RevSliderGlobals::$table_sliders, $where, $do_order, '', $order_direction);
$arrSliders = array();
foreach ($response as $arrData) {
$slider = new RevSlider();
$slider->initByDBData($arrData);
/*
This part needs to stay for backwards compatibility. It is used in the update process from v4x to v5x
*/
if ($templates === true) {
if ($slider->getParam("template", "false") == "false") {
continue;
}
} elseif ($templates === false) {
if ($slider->getParam("template", "false") == "true") {
continue;
}
}
$arrSliders[] = $slider;
}
if ($order_fav === true) {
$temp = array();
$temp_not = array();
foreach ($arrSliders as $key => $slider) {
if ($slider->isFavorite()) {
$temp_not[] = $slider;
} else {
$temp[] = $slider;
}
}
$arrSliders = array();
$arrSliders = $order_direction == 'ASC' ? array_merge($temp, $temp_not) : array_merge($temp_not, $temp);
}
return $arrSliders;
}