本文整理汇总了PHP中GDSRHelper::get_categories_hierarchy方法的典型用法代码示例。如果您正苦于以下问题:PHP GDSRHelper::get_categories_hierarchy方法的具体用法?PHP GDSRHelper::get_categories_hierarchy怎么用?PHP GDSRHelper::get_categories_hierarchy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GDSRHelper
的用法示例。
在下文中一共展示了GDSRHelper::get_categories_hierarchy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init_categories_data
function init_categories_data()
{
$all_cats = GDSRDatabase::get_all_categories();
$categories = GDSRHelper::get_categories_hierarchy($all_cats);
$ids_array = $items = array();
foreach ($categories as $cat) {
$items[$cat->term_id] = $cat->parent;
$ids_array[] = $cat->term_id;
}
GDSRDatabase::add_category_defaults("(" . join(", ", $ids_array) . ")", $ids_array, $items);
}
示例2: get_categories_hierarchy
function get_categories_hierarchy($cats, $depth = 0, $level = 0)
{
$h = array();
foreach ($cats as $cat) {
if ($cat->parent == $level) {
$cat->depth = $depth;
$h[] = $cat;
$recats = GDSRHelper::get_categories_hierarchy($cats, $depth + 1, $cat->term_id);
$h = array_merge($h, $recats);
}
}
return $h;
}
示例3: array
$page_id = $_GET["pg"];
}
if (isset($_POST["gdsr_update"]) && $_POST["gdsr_update"] == __("Update", "gd-star-rating")) {
$gdsr_items = $_POST["gdsr_item"];
if (count($gdsr_items) > 0) {
$items = $ids = array();
foreach ($gdsr_items as $it) {
$parts = explode(",", $it);
$ids[] = $parts[1];
$items[$parts[1]] = $parts[0];
}
gdsrAdmDB::update_category_settings("(" . join(", ", $gdsr_items) . ")", $ids, $items, $_POST["gdsr_article_moderation"], $_POST["gdsr_article_voterules"], $_POST["gdsr_comments_moderation"], $_POST["gdsr_comments_voterules"], $_POST["gdsr_integration_mur"], $_POST["gdsr_integration_active_std"], $_POST["gdsr_integration_active_mur"]);
}
}
$all_cats = GDSRDatabase::get_all_categories();
$categories = GDSRHelper::get_categories_hierarchy($all_cats);
$number_posts = count($categories);
$max_page = floor($number_posts / $posts_per_page);
if ($max_page * $posts_per_page != $number_posts) {
$max_page++;
}
$pager = $max_page > 1 ? gdFunctionsGDSR::draw_pager($max_page, $page_id, $url, "pg") : "";
$cat_from = ($page_id - 1) * $posts_per_page;
$cat_to = $page_id * $posts_per_page;
if ($cat_to > $number_posts) {
$cat_to = $number_posts;
}
?>
<div class="wrap">
<form id="gdsr-articles" method="post" action="">