当前位置: 首页>>代码示例>>PHP>>正文


PHP Members::count_articles_for_anchor方法代码示例

本文整理汇总了PHP中Members::count_articles_for_anchor方法的典型用法代码示例。如果您正苦于以下问题:PHP Members::count_articles_for_anchor方法的具体用法?PHP Members::count_articles_for_anchor怎么用?PHP Members::count_articles_for_anchor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Members的用法示例。


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

示例1: layout

 /**
  * list categories
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // empty list
     if (!SQL::count($result)) {
         $output = array();
         return $output;
     }
     // we return an array of ($url => $attributes)
     $items = array();
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // url to view the comment
         $url = Categories::get_permalink($item);
         // use the title to label the link
         $label = ucfirst(Skin::strip($item['title'], 20));
         // number of items for this category
         $count = 0;
         // count sections for this category
         if ($scount = Members::count_sections_for_anchor('category:' . $item['id'])) {
             $count += $scount;
         }
         // count articles for this category
         if ($acount = Members::count_articles_for_anchor('category:' . $item['id'])) {
             $count += $acount;
         }
         // format total count of items
         if ($count) {
             $count = ' (' . $count . ')';
         } else {
             $count = '';
         }
         // list all components for this item
         $items[$url] = array('', $label, $count, 'basic', NULL);
     }
     // end of processing
     SQL::free($result);
     return $items;
 }
开发者ID:rair,项目名称:yacs,代码行数:47,代码来源:layout_categories_as_compact.php

示例2: layout

 /**
  * list categories
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // empty list
     if (!SQL::count($result)) {
         $output = array();
         return $output;
     }
     // we return an array of ($url => $attributes)
     $items = array();
     // process all items in the list
     include_once $context['path_to_root'] . 'comments/comments.php';
     include_once $context['path_to_root'] . 'links/links.php';
     while ($item = SQL::fetch($result)) {
         // url to read the full category
         $url = Categories::get_permalink($item);
         // initialize variables
         $prefix = $suffix = $icon = '';
         // flag categories that are dead, or created or updated very recently
         if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
             $prefix .= EXPIRED_FLAG;
         } elseif ($item['create_date'] >= $context['fresh']) {
             $suffix .= NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $suffix .= UPDATED_FLAG;
         }
         // signal restricted and private categories
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // introduction
         if ($item['introduction']) {
             $suffix .= ' ' . Codes::beautify(trim($item['introduction']));
         }
         // details
         $details = array();
         // count related sub-elements
         $related_count = 0;
         // info on related categories
         $stats = Categories::stat_for_anchor('category:' . $item['id']);
         if ($stats['count']) {
             $details[] = sprintf(i18n::ns('%d category', '%d categories', $stats['count']), $stats['count']);
         }
         $related_count += $stats['count'];
         // info on related sections
         if ($count = Members::count_sections_for_anchor('category:' . $item['id'])) {
             $details[] = sprintf(i18n::ns('%d section', '%d sections', $count), $count);
             $related_count += $count;
         }
         // info on related articles
         if ($count = Members::count_articles_for_anchor('category:' . $item['id'])) {
             $details[] = sprintf(i18n::ns('%d page', '%d pages', $count), $count);
             $related_count += $count;
         }
         // info on related files
         if ($count = Files::count_for_anchor('category:' . $item['id'], TRUE)) {
             $details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
             $related_count += $count;
         }
         // info on related links
         if ($count = Links::count_for_anchor('category:' . $item['id'], TRUE)) {
             $details[] = sprintf(i18n::ns('%d link', '%d links', $count), $count);
             $related_count += $count;
         }
         // info on related comments
         if ($count = Comments::count_for_anchor('category:' . $item['id'], TRUE)) {
             $details[] = sprintf(i18n::ns('%d comment', '%d comments', $count), $count);
             $related_count += $stats['count'];
         }
         // info on related users
         if ($count = Members::count_users_for_anchor('category:' . $item['id'])) {
             $details[] = sprintf(i18n::ns('%d user', '%d users', $count), $count);
         }
         // append details to the suffix
         if (count($details)) {
             $suffix .= "\n" . '<span class="details">(' . implode(', ', $details) . ')</span>';
         }
         // add a head list of related links
         $details = array();
         // add sub-categories on index pages
         if ($related = Categories::list_by_date_for_anchor('category:' . $item['id'], 0, YAHOO_LIST_SIZE, 'compact')) {
             foreach ($related as $sub_url => $label) {
                 $sub_prefix = $sub_suffix = $sub_hover = '';
                 if (is_array($label)) {
                     $sub_prefix = $label[0];
                     $sub_suffix = $label[2];
                     if (@$label[5]) {
                         $sub_hover = $label[5];
                     }
                     $label = $label[1];
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_categories_as_yahoo.php

示例3: layout

 /**
  * list categories
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // empty list
     if (!SQL::count($result)) {
         $output = array();
         return $output;
     }
     // we return an array of ($url => $attributes)
     $items = array();
     // process all items in the list
     include_once $context['path_to_root'] . 'comments/comments.php';
     include_once $context['path_to_root'] . 'links/links.php';
     while ($item = SQL::fetch($result)) {
         // url to read the full category
         $url = Categories::get_permalink($item);
         // initialize variables
         $prefix = $suffix = $icon = '';
         // flag categories that are dead, or created or updated very recently
         if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
             $prefix .= EXPIRED_FLAG;
         } elseif ($item['create_date'] >= $context['fresh']) {
             $suffix .= NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $suffix .= UPDATED_FLAG;
         }
         // signal restricted and private categories
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // use the title to label the link
         $label = Skin::strip($item['title'], 10);
         // details
         $details = array();
         // info on related categories
         $stats = Categories::stat_for_anchor('category:' . $item['id']);
         if ($stats['count']) {
             $details[] = sprintf(i18n::ns('%d category', '%d categories', $stats['count']), $stats['count']);
         }
         // info on related sections
         if ($count = Members::count_sections_for_anchor('category:' . $item['id'])) {
             $details[] = sprintf(i18n::ns('%d section', '%d sections', $count), $count);
         }
         // info on related articles
         if ($count = Members::count_articles_for_anchor('category:' . $item['id'])) {
             $details[] = sprintf(i18n::ns('%d page', '%d pages', $count), $count);
         }
         // info on related files
         if ($count = Files::count_for_anchor('category:' . $item['id'], TRUE)) {
             $details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
         }
         // info on related links
         if ($count = Links::count_for_anchor('category:' . $item['id'], TRUE)) {
             $details[] = sprintf(i18n::ns('%d link', '%d links', $count), $count);
         }
         // info on related comments
         if ($count = Comments::count_for_anchor('category:' . $item['id'], TRUE)) {
             $details[] = sprintf(i18n::ns('%d comment', '%d comments', $count), $count);
         }
         // info on related users
         if ($count = Members::count_users_for_anchor('category:' . $item['id'])) {
             $details[] = sprintf(i18n::ns('%d user', '%d users', $count), $count);
         }
         // append details to the suffix
         if (count($details)) {
             $suffix .= "\n" . '<span class="details">(' . implode(', ', $details) . ')</span>';
         }
         // introduction
         if ($item['introduction']) {
             $suffix .= ' ' . Codes::beautify(trim($item['introduction']));
         }
         // put the actual icon in the left column
         if (isset($item['thumbnail_url']) && $this->layout_variant != 'sidebar') {
             $icon = $item['thumbnail_url'];
         }
         // list all components for this item
         $items[$url] = array($prefix, $label, $suffix, 'category', $icon);
     }
     // end of processing
     SQL::free($result);
     return $items;
 }
开发者ID:rair,项目名称:yacs,代码行数:92,代码来源:layout_categories.php

示例4: layout

 /**
  * list categories for search requests
  *
  * @param resource the SQL result
  * @return array of resulting items ($score, $summary), or NULL
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // we return an array of array($score, $summary)
     $items = array();
     // empty list
     if (!SQL::count($result)) {
         return $items;
     }
     // process all items in the list
     include_once $context['path_to_root'] . 'comments/comments.php';
     include_once $context['path_to_root'] . 'links/links.php';
     while ($item = SQL::fetch($result)) {
         // one box at a time
         $box = '';
         // get the main anchor
         $anchor = Anchors::get($item['anchor']);
         // url to read the full category
         $url = Categories::get_permalink($item);
         // initialize variables
         $prefix = $suffix = $icon = '';
         // flag categories that are dead, or created or updated very recently
         if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
             $prefix .= EXPIRED_FLAG;
         } elseif ($item['create_date'] >= $context['fresh']) {
             $suffix .= NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $suffix .= UPDATED_FLAG;
         }
         // signal restricted and private categories
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // use the title to label the link
         $title = Skin::strip($item['title'], 10);
         // details
         $details = array();
         // info on related categories
         $stats = Categories::stat_for_anchor('category:' . $item['id']);
         if ($stats['count']) {
             $details[] = sprintf(i18n::ns('%d category', '%d categories', $stats['count']), $stats['count']);
         }
         // info on related sections
         if ($count = Members::count_sections_for_anchor('category:' . $item['id'])) {
             $details[] = sprintf(i18n::ns('%d section', '%d sections', $count), $count);
         }
         // info on related articles
         if ($count = Members::count_articles_for_anchor('category:' . $item['id'])) {
             $details[] = sprintf(i18n::ns('%d page', '%d pages', $count), $count);
         }
         // info on related files
         if ($count = Files::count_for_anchor('category:' . $item['id'], TRUE)) {
             $details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
         }
         // info on related links
         if ($count = Links::count_for_anchor('category:' . $item['id'], TRUE)) {
             $details[] = sprintf(i18n::ns('%d link', '%d links', $count), $count);
         }
         // info on related comments
         if ($count = Comments::count_for_anchor('category:' . $item['id'], TRUE)) {
             $details[] = sprintf(i18n::ns('%d comment', '%d comments', $count), $count);
         }
         // info on related users
         if ($count = Members::count_users_for_anchor('category:' . $item['id'])) {
             $details[] = sprintf(i18n::ns('%d user', '%d users', $count), $count);
         }
         // the main anchor link
         if (is_object($anchor)) {
             $details[] = sprintf(i18n::s('in %s'), Skin::build_link($anchor->get_url(), ucfirst($anchor->get_title()), 'category'));
         }
         // append details to the suffix
         if (count($details)) {
             $suffix .= "\n" . '<span class="details">(' . implode(', ', $details) . ')</span>';
         }
         // introduction
         if ($item['introduction']) {
             $suffix .= ' ' . Codes::beautify(trim($item['introduction']));
         }
         // item summary
         $box .= $prefix . Skin::build_link($url, $title, 'category') . $suffix;
         // put the actual icon in the left column
         if (isset($item['thumbnail_url']) && $this->layout_variant != 'sidebar') {
             $icon = $item['thumbnail_url'];
         }
         // layout this item
         if ($icon) {
             // build the complete HTML element
             $icon = '<img src="' . $icon . '" alt="" title="' . encode_field(strip_tags($title)) . '" />';
             // make it a clickable link
             $icon = Skin::build_link($url, $icon, 'basic');
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_categories_as_search.php

示例5: one

 /**
  * format just one item
  *
  * This is used within this script, but also to shape sections assigned
  * to the surfer in the web form for new articles.
  *
  * @param array attributes of one item
  * @return array of ($url => array($prefix, $label, $suffix, ...))
  *
  * @see articles/edit.php
  **/
 function one(&$item)
 {
     global $context;
     // this function is invoked directly from articles/edit.php
     include_once $context['path_to_root'] . 'comments/comments.php';
     include_once $context['path_to_root'] . 'links/links.php';
     // sanity check
     if (!isset($this->layout_variant)) {
         $this->layout_variant = 'articles/edit.php?anchor=section:';
     }
     // initialize variables
     $prefix = $suffix = $icon = '';
     // flag sections that are draft, dead, or created or updated very recently
     if ($item['activation_date'] >= $context['now']) {
         $prefix .= DRAFT_FLAG;
     } elseif ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
         $prefix .= EXPIRED_FLAG;
     } elseif ($item['create_date'] >= $context['fresh']) {
         $suffix .= NEW_FLAG;
     } elseif ($item['edit_date'] >= $context['fresh']) {
         $suffix .= UPDATED_FLAG;
     }
     // signal restricted and private sections
     if ($item['active'] == 'N') {
         $prefix .= PRIVATE_FLAG;
     } elseif ($item['active'] == 'R') {
         $prefix .= RESTRICTED_FLAG;
     }
     // details
     $details = array();
     // info on related articles
     if ($count = Members::count_articles_for_anchor('section:' . $item['id'])) {
         $details[] = sprintf(i18n::ns('%d page', '%d pages', $count), $count);
     }
     // info on related files
     if ($count = Files::count_for_anchor('section:' . $item['id'], TRUE)) {
         $details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
     }
     // info on related links
     if ($count = Links::count_for_anchor('section:' . $item['id'], TRUE)) {
         $details[] = sprintf(i18n::ns('%d link', '%d links', $count), $count);
     }
     // info on related comments
     if ($count = Comments::count_for_anchor('section:' . $item['id'], TRUE)) {
         $details[] = sprintf(i18n::ns('%d comment', '%d comments', $count), $count);
     }
     // append details to the suffix
     if (count($details)) {
         $suffix .= "\n" . '<span class="details">(' . implode(', ', $details) . ')</span>';
     }
     // introduction
     if ($item['introduction']) {
         $suffix .= ' ' . Codes::beautify_introduction(trim($item['introduction']));
     }
     // add a head list of related links
     $subs = array();
     // add sub-sections on index pages
     if ($related =& Sections::list_by_title_for_anchor('section:' . $item['id'], 0, 2 * YAHOO_LIST_SIZE, 'raw')) {
         foreach ($related as $id => $attributes) {
             // look for sub-sub-sections
             $leaves = array();
             if ($children =& Sections::list_by_title_for_anchor('section:' . $id, 0, 50, 'raw')) {
                 foreach ($children as $child_id => $child_attributes) {
                     $child_url = $this->layout_variant . $child_id;
                     $leaves[$child_url] = $child_attributes['title'];
                 }
             }
             // link for this sub-section
             $url = $this->layout_variant . $id;
             // expose sub-sub-sections as well
             if (count($leaves) > YAHOO_LIST_SIZE) {
                 $subs[$url] = array('', $attributes['title'], Skin::build_box(i18n::s('More spaces'), Skin::build_list($leaves, 'compact'), 'folded'));
             } elseif (count($leaves)) {
                 $subs[$url] = array('', $attributes['title'], Skin::build_list($leaves, 'compact'));
             } else {
                 $subs[$url] = $attributes['title'];
             }
         }
     }
     // one sub-section per line
     if (count($subs)) {
         $suffix .= Skin::build_list($subs, 'compact');
     }
     // put the actual icon in the left column
     if (isset($item['thumbnail_url'])) {
         $icon = $item['thumbnail_url'];
     }
     // only associates and editors can post to a locked section
     if (isset($item['locked']) && $item['locked'] == 'Y' && !Surfer::is_empowered()) {
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_sections_as_select.php

示例6: array

 //
 // the list of related articles if not at another follow-up page
 if ((!$zoom_type || $zoom_type == 'articles') && (!isset($item['articles_layout']) || $item['articles_layout'] != 'none')) {
     // build a complete box
     $box = array('bar' => array(), 'text' => '');
     // select a layout
     if (!isset($item['articles_layout']) || !$item['articles_layout']) {
         include_once '../articles/layout_articles.php';
         $layout_articles = new Layout_articles();
     } else {
         $layout_articles = Layouts::new_($item['articles_layout'], 'article');
     }
     // do not refer to this category
     $layout_articles->set_focus('category:' . $item['id']);
     // count the number of articles in this category
     $count = Members::count_articles_for_anchor('category:' . $item['id'], $this_cat->get_listed_lang());
     if ($count) {
         $box['bar'] = array('_count' => sprintf(i18n::ns('%d page', '%d pages', $count), $count));
     }
     // navigation commands for articles
     $home = Categories::get_permalink($item);
     $prefix = Categories::get_url($item['id'], 'navigate', 'articles');
     $box['bar'] = array_merge($box['bar'], Skin::navigate($home, $prefix, $count, ARTICLES_PER_PAGE, $zoom_index));
     // list items by date (default) or by title (option 'articles_by_title') or by rating_sum (option article_by_rating)
     $offset = ($zoom_index - 1) * ARTICLES_PER_PAGE;
     if (isset($order) && preg_match('/\\barticles_by_rating\\b/i', $order)) {
         $items =& Members::list_articles_by_rating_for_anchor('category:' . $item['id'], $offset, ARTICLES_PER_PAGE, $layout_articles, $this_cat->get_listed_lang());
     } elseif (isset($item['options']) && preg_match('/\\barticles_by_title\\b/i', $item['options'])) {
         $items =& Members::list_articles_by_title_for_anchor('category:' . $item['id'], $offset, ARTICLES_PER_PAGE, $layout_articles, $this_cat->get_listed_lang());
     } else {
         $items =& Members::list_articles_by_date_for_anchor('category:' . $item['id'], $offset, ARTICLES_PER_PAGE, $layout_articles, $this_cat->get_listed_lang());
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:view.php


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