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


PHP ProductCategory::tree方法代碼示例

本文整理匯總了PHP中ProductCategory::tree方法的典型用法代碼示例。如果您正苦於以下問題:PHP ProductCategory::tree方法的具體用法?PHP ProductCategory::tree怎麽用?PHP ProductCategory::tree使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ProductCategory的用法示例。


在下文中一共展示了ProductCategory::tree方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: categories

 public function categories()
 {
     if (!current_user_can('shopp_categories')) {
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     $per_page_option = get_current_screen()->get_option('per_page');
     $defaults = array('paged' => 1, 'per_page' => 20, 's' => '', 'a' => '');
     $args = array_merge($defaults, $_GET);
     if (false !== ($user_per_page = get_user_option($per_page_option['option']))) {
         $args['per_page'] = $user_per_page;
     }
     extract($args, EXTR_SKIP);
     if ('arrange' == $a) {
         $this->init_positions();
         $per_page = 300;
     }
     $paged = absint($paged);
     $start = $per_page * ($paged - 1);
     $end = $start + $per_page;
     $url = add_query_arg(array_merge($_GET, array('page' => ShoppAdmin::pagename('categories'))), admin_url('admin.php'));
     $taxonomy = 'shopp_category';
     $filters = array('hide_empty' => 0, 'fields' => 'id=>parent');
     add_filter('get_shopp_category', array($this, 'load_category'), 10, 2);
     // $filters['limit'] = "$start,$per_page";
     if (!empty($s)) {
         $filters['search'] = $s;
     }
     $Categories = array();
     $count = 0;
     $terms = get_terms($taxonomy, $filters);
     if (empty($s)) {
         $children = _get_term_hierarchy($taxonomy);
         ProductCategory::tree($taxonomy, $terms, $children, $count, $Categories, $paged, $per_page);
         $this->categories = $Categories;
     } else {
         foreach ($terms as $id => $parent) {
             $Categories[$id] = get_term($id, $taxonomy);
         }
     }
     $ids = array_keys($Categories);
     return $ids;
 }
開發者ID:forthrobot,項目名稱:inuvik,代碼行數:42,代碼來源:Categories.php

示例2: categories

 /**
  * Interface processor for the category list manager
  *
  * @author Jonathan Davis
  * @since 1.0
  * @return void
  **/
 public function categories($workflow = false)
 {
     if (!current_user_can('shopp_categories')) {
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     $per_page_option = get_current_screen()->get_option('per_page');
     $defaults = array('paged' => 1, 'per_page' => 20, 's' => '', 'a' => '');
     $args = array_merge($defaults, $_GET);
     if (false !== ($user_per_page = get_user_option($per_page_option['option']))) {
         $args['per_page'] = $user_per_page;
     }
     extract($args, EXTR_SKIP);
     if ('arrange' == $a) {
         $this->init_positions();
         $per_page = 300;
     }
     $paged = absint($paged);
     $start = $per_page * ($paged - 1);
     $end = $start + $per_page;
     $url = add_query_arg(array_merge($_GET, array('page' => $this->Admin->pagename('categories'))), admin_url('admin.php'));
     $taxonomy = 'shopp_category';
     $filters = array('hide_empty' => 0, 'fields' => 'id=>parent');
     add_filter('get_shopp_category', array($this, 'load_category'), 10, 2);
     // $filters['limit'] = "$start,$per_page";
     if (!empty($s)) {
         $filters['search'] = $s;
     }
     $Categories = array();
     $count = 0;
     $terms = get_terms($taxonomy, $filters);
     if (empty($s)) {
         $children = _get_term_hierarchy($taxonomy);
         ProductCategory::tree($taxonomy, $terms, $children, $count, $Categories, $paged, $per_page);
         $this->categories = $Categories;
     } else {
         foreach ($terms as $id => $parent) {
             $Categories[$id] = get_term($id, $taxonomy);
         }
     }
     $ids = array_keys($Categories);
     if ($workflow) {
         return $ids;
     }
     $meta = ShoppDatabaseObject::tablename(ShoppMetaObject::$table);
     if (!empty($ids)) {
         sDB::query("SELECT * FROM {$meta} WHERE parent IN (" . join(',', $ids) . ") AND context='category' AND type='meta'", 'array', array($this, 'metaloader'));
     }
     $count = wp_count_terms('shopp_category');
     $num_pages = ceil($count / $per_page);
     $ListTable = ShoppUI::table_set_pagination($this->screen, $count, $num_pages, $per_page);
     $action = esc_url(add_query_arg(array_merge(stripslashes_deep($_GET), array('page' => $this->Admin->pagename('categories'))), admin_url('admin.php')));
     include $this->ui('categories.php');
 }
開發者ID:BlessySoftwares,項目名稱:anvelocom,代碼行數:60,代碼來源:Categorize.php


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