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


PHP BP_Groups_Group::get_by_letter方法代碼示例

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


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

示例1: test_get_by_letter_starts_with_apostrophe

 public function test_get_by_letter_starts_with_apostrophe()
 {
     $g1 = $this->factory->group->create(array('name' => "'Tis Sweet", 'description' => 'Neat'));
     $g2 = $this->factory->group->create(array('name' => 'Another Cool Group', 'description' => 'Awesome'));
     $groups = BP_Groups_Group::get_by_letter("'");
     $found = wp_list_pluck($groups['groups'], 'id');
     // @todo
     // The test fails but at least it's sanitized
     //$this->assertEquals( array( $g1->id ), $found );
 }
開發者ID:swissspidy,項目名稱:BuddyPress,代碼行數:10,代碼來源:class-bp-groups-group.php

示例2: bp_groups_site_groups_template

 function bp_groups_site_groups_template($type, $per_page, $max)
 {
     global $bp;
     $this->pag_page = isset($_REQUEST['gpage']) ? intval($_REQUEST['gpage']) : 1;
     $this->pag_num = isset($_REQUEST['num']) ? intval($_REQUEST['num']) : $per_page;
     if (isset($_REQUEST['s']) && '' != $_REQUEST['s'] && $type != 'random') {
         $this->groups = BP_Groups_Group::search_groups($_REQUEST['s'], $this->pag_num, $this->pag_page);
     } else {
         if (isset($_REQUEST['letter']) && '' != $_REQUEST['letter']) {
             $this->groups = BP_Groups_Group::get_by_letter($_REQUEST['letter'], $this->pag_num, $this->pag_page);
         } else {
             switch ($type) {
                 case 'random':
                     $this->groups = BP_Groups_Group::get_random($this->pag_num, $this->pag_page);
                     break;
                 case 'newest':
                     $this->groups = BP_Groups_Group::get_newest($this->pag_num, $this->pag_page);
                     break;
                 case 'popular':
                     $this->groups = BP_Groups_Group::get_popular($this->pag_num, $this->pag_page);
                     break;
                 case 'active':
                 default:
                     $this->groups = BP_Groups_Group::get_active($this->pag_num, $this->pag_page);
                     break;
             }
         }
     }
     if (!$max) {
         $this->total_group_count = (int) $this->groups['total'];
     } else {
         $this->total_group_count = (int) $max;
     }
     $this->groups = $this->groups['groups'];
     if ($max) {
         if ($max >= count($this->groups)) {
             $this->group_count = count($this->groups);
         } else {
             $this->group_count = (int) $max;
         }
     } else {
         $this->group_count = count($this->groups);
     }
     $this->pag_links = paginate_links(array('base' => add_query_arg('gpage', '%#%'), 'format' => '', 'total' => ceil((int) $this->total_group_count / (int) $this->pag_num), 'current' => (int) $this->pag_page, 'prev_text' => '«', 'next_text' => '»', 'mid_size' => 1));
 }
開發者ID:alvaropereyra,項目名稱:shrekcms,代碼行數:45,代碼來源:bp-groups-templatetags.php


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