當前位置: 首頁>>代碼示例>>PHP>>正文


PHP GDSRHelper::get_categories_hierarchy方法代碼示例

本文整理匯總了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);
 }
開發者ID:pyropictures,項目名稱:wordpress-plugins,代碼行數:11,代碼來源:main.php

示例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;
 }
開發者ID:sangpena,項目名稱:appflex.mobi,代碼行數:13,代碼來源:elements.php

示例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="">
開發者ID:TheReaCompany,項目名稱:pooplog,代碼行數:31,代碼來源:categories.php


注:本文中的GDSRHelper::get_categories_hierarchy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。