本文整理汇总了PHP中Versions::stat_for_anchor方法的典型用法代码示例。如果您正苦于以下问题:PHP Versions::stat_for_anchor方法的具体用法?PHP Versions::stat_for_anchor怎么用?PHP Versions::stat_for_anchor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Versions
的用法示例。
在下文中一共展示了Versions::stat_for_anchor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: stat_related_to
/**
* count related items
*
* This function draws a nice table to show how many items are related to
* the anchor that has the focus.
*
* @param string the target reference
* @param string the label to use, if any
* @return string some XHTML snippet to send to the browser
*/
public static function stat_related_to($anchor, $label = NULL)
{
global $context;
// describe related content
$related = '';
$lines = 2;
// stats for related categories, but only within categories
if (strpos($anchor, 'category:') === 0) {
if (($stats = Categories::stat_for_anchor($anchor)) && $stats['count']) {
$cells = array();
$cells[] = i18n::s('Categories');
$cells[] = 'center=' . $stats['count'];
$cells[] = 'center=' . Skin::build_date($stats['oldest_date']);
$cells[] = 'center=' . Skin::build_date($stats['newest_date']);
$related .= Skin::table_row($cells, $lines++);
}
}
// stats for related sections, but only within sections
if (strpos($anchor, 'section:') === 0) {
if (($stats = Sections::stat_for_anchor($anchor)) && $stats['count']) {
$cells = array();
$cells[] = i18n::s('Sections');
$cells[] = 'center=' . $stats['count'];
$cells[] = 'center=' . Skin::build_date($stats['oldest_date']);
$cells[] = 'center=' . Skin::build_date($stats['newest_date']);
$related .= Skin::table_row($cells, $lines++);
}
}
// stats for related articles, but only within sections
if (strpos($anchor, 'section:') === 0) {
if (($stats = Articles::stat_for_anchor($anchor)) && $stats['count']) {
$cells = array();
$cells[] = i18n::s('Pages');
$cells[] = 'center=' . $stats['count'];
$cells[] = 'center=' . Skin::build_date($stats['oldest_date']);
$cells[] = 'center=' . Skin::build_date($stats['newest_date']);
$related .= Skin::table_row($cells, $lines++);
}
}
// stats for related images
include_once $context['path_to_root'] . 'images/images.php';
if (($stats = Images::stat_for_anchor($anchor)) && $stats['count']) {
$cells = array();
$cells[] = i18n::s('Images');
$cells[] = 'center=' . $stats['count'];
$cells[] = 'center=' . Skin::build_date($stats['oldest_date']);
$cells[] = 'center=' . Skin::build_date($stats['newest_date']);
$related .= Skin::table_row($cells, $lines++);
}
// stats for related locations
include_once $context['path_to_root'] . 'locations/locations.php';
if (($stats = Locations::stat_for_anchor($anchor)) && $stats['count']) {
$cells = array();
$cells[] = i18n::s('Locations');
$cells[] = 'center=' . $stats['count'];
$cells[] = 'center=' . Skin::build_date($stats['oldest_date']);
$cells[] = 'center=' . Skin::build_date($stats['newest_date']);
$related .= Skin::table_row($cells, $lines++);
}
// stats for related tables
include_once $context['path_to_root'] . 'tables/tables.php';
if (($stats = Tables::stat_for_anchor($anchor)) && $stats['count']) {
$cells = array();
$cells[] = i18n::s('Tables');
$cells[] = 'center=' . $stats['count'];
$cells[] = 'center=' . Skin::build_date($stats['oldest_date']);
$cells[] = 'center=' . Skin::build_date($stats['newest_date']);
$related .= Skin::table_row($cells, $lines++);
}
// stats for related files
if (($stats = Files::stat_for_anchor($anchor)) && $stats['count']) {
$cells = array();
$cells[] = i18n::s('Files');
$cells[] = 'center=' . $stats['count'];
$cells[] = 'center=' . Skin::build_date($stats['oldest_date']);
$cells[] = 'center=' . Skin::build_date($stats['newest_date']);
$related .= Skin::table_row($cells, $lines++);
}
// stats for related dates
include_once $context['path_to_root'] . 'dates/dates.php';
if (($stats = Dates::stat_for_anchor($anchor)) && $stats['count']) {
$cells = array();
$cells[] = i18n::s('Dates');
$cells[] = 'center=' . $stats['count'];
$cells[] = 'center=' . Skin::build_date($stats['oldest_date']);
$cells[] = 'center=' . Skin::build_date($stats['newest_date']);
$related .= Skin::table_row($cells, $lines++);
}
// stats for related comments
include_once $context['path_to_root'] . 'comments/comments.php';
//.........这里部分代码省略.........
示例2: array
Logger::error(i18n::s('You are not allowed to perform this operation.'));
// display the index
} else {
// insert anchor prefix
if (is_object($anchor)) {
$context['text'] .= $anchor->get_prefix();
}
// cache the section
$cache_id = 'versions/list.php?id=' . $anchor->get_reference() . '#' . $page;
if (!($text = Cache::get($cache_id))) {
// section title
$box['title'] = '';
$box['bar'] = array();
$box['text'] = '';
// count versions in the database
$stats = Versions::stat_for_anchor($anchor->get_reference());
$stats['count'] += 1;
if ($stats['count'] > VERSIONS_PER_PAGE) {
// total count of versions
$box['bar'] += array('_count' => sprintf(i18n::ns('%d version', '%d versions', $stats['count']), $stats['count']));
// navigation commands
$home = 'versions/list.php';
if ($context['with_friendly_urls'] == 'Y') {
$prefix = $home . '/' . str_replace(':', '/', $anchor->get_reference());
} elseif ($context['with_friendly_urls'] == 'R') {
$prefix = $home . '/' . str_replace(':', '/', $anchor->get_reference());
} else {
$prefix = $home . '?id=' . $anchor->get_reference() . '&page=';
}
$box['bar'] += Skin::navigate($home, $prefix, $stats['count'], VERSIONS_PER_PAGE, $page);
}