当前位置: 首页>>代码示例>>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;未经允许,请勿转载。