• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP icl_get_tax_children_recursive函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中icl_get_tax_children_recursive函数的典型用法代码示例。如果您正苦于以下问题:PHP icl_get_tax_children_recursive函数的具体用法?PHP icl_get_tax_children_recursive怎么用?PHP icl_get_tax_children_recursive使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了icl_get_tax_children_recursive函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: icl_get_tax_children_recursive

function icl_get_tax_children_recursive($id, $taxonomy = 'category')
{
    global $wpdb;
    $id = (array) $id;
    $children = $wpdb->get_col($wpdb->prepare("SELECT term_id FROM {$wpdb->term_taxonomy} x WHERE x.taxonomy=%s AND parent IN (" . join(',', $id) . ")", $taxonomy));
    if (!empty($children)) {
        $children = array_merge($children, icl_get_tax_children_recursive($children));
    }
    return $children;
}
开发者ID:ViktorLinnasaar,项目名称:hanset,代码行数:10,代码来源:functions.php


示例2: get_documents


//.........这里部分代码省略.........
                 $where .= " AND (iclts.status = " . ICL_TM_COMPLETE . " OR iclts.status = " . ICL_TM_DUPLICATE . ") AND iclts.needs_update = 0\n";
             }
         } elseif ($active_languages && count($active_languages) > 1) {
             if ($tstatus == 'not') {
                 $where .= " AND (";
                 $wheres = array();
                 foreach ($active_languages as $lang) {
                     if ($lang['code'] == $from_lang) {
                         continue;
                     }
                     $tbl_alias_suffix = str_replace('-', '_', $lang['code']);
                     $wheres[] = "iclts_{$tbl_alias_suffix}.status IS NULL OR iclts_{$tbl_alias_suffix}.status = " . ICL_TM_WAITING_FOR_TRANSLATOR . " OR iclts_{$tbl_alias_suffix}.needs_update = 1\n";
                 }
                 $where .= join(' OR ', $wheres) . ")";
             } elseif ($tstatus == 'need-update') {
                 $where .= " AND (";
                 $wheres = array();
                 foreach ($active_languages as $lang) {
                     if ($lang['code'] == $from_lang) {
                         continue;
                     }
                     $tbl_alias_suffix = str_replace('-', '_', $lang['code']);
                     $wheres[] = "iclts_{$tbl_alias_suffix}.needs_update = 1\n";
                 }
                 $where .= join(' OR ', $wheres) . ")";
             } elseif ($tstatus == 'in_progress') {
                 $where .= " AND (";
                 $wheres = array();
                 foreach ($active_languages as $lang) {
                     if ($lang['code'] == $from_lang) {
                         continue;
                     }
                     $tbl_alias_suffix = str_replace('-', '_', $lang['code']);
                     $wheres[] = "iclts_{$tbl_alias_suffix}.status = " . ICL_TM_IN_PROGRESS . "\n";
                 }
                 $where .= join(' OR ', $wheres) . ")";
             } elseif ($tstatus == 'complete') {
                 foreach ($active_languages as $lang) {
                     if ($lang['code'] == $from_lang) {
                         continue;
                     }
                     $tbl_alias_suffix = str_replace('-', '_', $lang['code']);
                     $where .= " AND (iclts_{$tbl_alias_suffix}.status = " . ICL_TM_COMPLETE . " OR iclts_{$tbl_alias_suffix}.status = " . ICL_TM_DUPLICATE . ") AND iclts_{$tbl_alias_suffix}.needs_update = 0\n";
                 }
             }
         }
     }
     if (isset($parent_type) && $parent_type == 'page' && $parent_id > 0) {
         if ($parent_all) {
             $children = icl_get_post_children_recursive($parent_id);
             if (!$children) {
                 $children[] = -1;
             }
             $where .= ' AND p.ID IN (' . join(',', $children) . ')';
         } else {
             $where .= ' AND p.post_parent=' . intval($parent_id);
         }
     }
     if (isset($parent_type) && $parent_type == 'category' && $parent_id > 0) {
         if ($parent_all) {
             $children = icl_get_tax_children_recursive($parent_id);
             $children[] = $parent_id;
             $join .= "  JOIN {$wpdb->term_relationships} tr ON p.ID = tr.object_id\n\t\t\t\t\t\t\tJOIN {$wpdb->term_taxonomy} tt ON tr.term_taxonomy_id = tt.term_taxonomy_id AND taxonomy = 'category'\n\t\t\t\t\t\t\tJOIN {$wpdb->terms} tm ON tt.term_id = tm.term_id AND tm.term_id IN(" . join(',', $children) . ")";
         } else {
             $join .= "  JOIN {$wpdb->term_relationships} tr ON p.ID = tr.object_id\n\t\t\t\t\t\t\tJOIN {$wpdb->term_taxonomy} tt ON tr.term_taxonomy_id = tt.term_taxonomy_id AND taxonomy = 'category'\n\t\t\t\t\t\t\tJOIN {$wpdb->terms} tm ON tt.term_id = tm.term_id AND tm.term_id = " . intval($parent_id);
         }
     }
     // ORDER
     if ($sort_by) {
         $order = " {$sort_by} ";
     } else {
         $order = " p.post_date DESC";
     }
     if ($sort_order) {
         $order .= $sort_order;
     } else {
         $order .= 'DESC';
     }
     // LIMIT
     if (!isset($_GET['paged'])) {
         $_GET['paged'] = 1;
     }
     $offset = ($_GET['paged'] - 1) * $limit_no;
     $limit = " " . $offset . ',' . $limit_no;
     $sql = "\n\t\t\tSELECT SQL_CALC_FOUND_ROWS {$select}\n\t\t\tFROM {$from}\n\t\t\t{$join}\n\t\t\tWHERE {$where}\n\t\t\tORDER BY {$order}\n\t\t\tLIMIT {$limit}\n\t\t";
     $results = $wpdb->get_results($sql);
     $count = $wpdb->get_var("SELECT FOUND_ROWS()");
     $wp_query->found_posts = $count;
     $wp_query->query_vars['posts_per_page'] = $limit_no;
     $wp_query->max_num_pages = ceil($wp_query->found_posts / $limit_no);
     // post process
     foreach ($results as $k => $v) {
         if ($v->is_translation) {
             $source_language = $wpdb->get_var($wpdb->prepare("SELECT language_code FROM {$wpdb->prefix}icl_translations WHERE trid=%d AND source_language_code IS NULL", $v->trid));
             $_tmp = 'status_' . $source_language;
             $v->{$_tmp} = ICL_TM_COMPLETE;
         }
     }
     return $results;
 }
开发者ID:Calraiser,项目名称:flux,代码行数:101,代码来源:translation-management.class.php



注:本文中的icl_get_tax_children_recursive函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP icl_js_escape函数代码示例发布时间:2022-05-15
下一篇:
PHP icl_get_string_translations_by_id函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap