本文整理汇总了PHP中Comments::get_form方法的典型用法代码示例。如果您正苦于以下问题:PHP Comments::get_form方法的具体用法?PHP Comments::get_form怎么用?PHP Comments::get_form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Comments
的用法示例。
在下文中一共展示了Comments::get_form方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
// the maximum number of comments per page
if (is_object($layout)) {
$items_per_page = $layout->items_per_page();
} else {
$items_per_page = COMMENTS_PER_PAGE;
}
// the first comment to list
$offset = ($zoom_index - 1) * $items_per_page;
if (is_object($layout) && method_exists($layout, 'set_offset')) {
$layout->set_offset($offset);
}
// build a complete box
$box = array('bar' => array(), 'text' => '');
// new comments are allowed
if (Comments::allow_creation($item, $anchor, 'section')) {
$box['text'] .= Comments::get_form('section:' . $item['id']);
}
// a navigation bar for these comments
if ($count = Comments::count_for_anchor('section:' . $item['id'])) {
if ($count > 20) {
$box['bar'] += array('_count' => sprintf(i18n::s('%d comments'), $count));
}
// list comments by date
$items = Comments::list_by_date_for_anchor('section:' . $item['id'], $offset, $items_per_page, $layout, TRUE);
// actually render the html
if (is_array($items)) {
$box['text'] .= Skin::build_list($items, 'rows');
} elseif (is_string($items)) {
$box['text'] .= $items;
}
// navigation commands for comments
示例2: layout
//.........这里部分代码省略.........
$text .= Skin::build_content('files', i18n::s('Files'), $box['text'], $box['bar']);
}
// list of comments
$title_label = '';
if (is_object($anchor)) {
$title_label = ucfirst($overlay->get_label('list_title', 'comments'));
}
if (!$title_label) {
$title_label = i18n::s('Comments');
}
// no layout yet
$layout = NULL;
// label to create a comment
$add_label = '';
if (is_object($overlay)) {
$add_label = $overlay->get_label('new_command', 'comments');
}
if (!$add_label) {
$add_label = i18n::s('Post a comment');
}
// get a layout from anchor
$layout =& Comments::get_layout($anchor, $item);
// provide author information to layout
if (is_object($layout) && isset($item['create_id']) && $item['create_id']) {
$layout->set_focus('user:' . $item['create_id']);
}
// the maximum number of comments per page
if (is_object($layout)) {
$items_per_page = $layout->items_per_page();
} else {
$items_per_page = COMMENTS_PER_PAGE;
}
// the first comment to list
$offset = 0;
if (is_object($layout) && method_exists($layout, 'set_offset')) {
$layout->set_offset($offset);
}
// build a complete box
$box = array('bar' => array(), 'prefix_bar' => array(), 'text' => '');
// feed the wall
if (Comments::allow_creation($item, $anchor)) {
$box['text'] .= Comments::get_form('article:' . $item['id']);
}
// a navigation bar for these comments
if ($count = Comments::count_for_anchor('article:' . $item['id'])) {
if ($count > 20) {
$box['bar'] += array('_count' => sprintf(i18n::ns('%d comment', '%d comments', $count), $count));
}
// list comments by date
$items = Comments::list_by_date_for_anchor('article:' . $item['id'], $offset, $items_per_page, $layout, TRUE);
// actually render the html
if (is_array($items)) {
$box['text'] .= Skin::build_list($items, 'rows');
} elseif (is_string($items)) {
$box['text'] .= $items;
}
// navigation commands for comments
$prefix = Comments::get_url('article:' . $item['id'], 'navigate');
$box['bar'] = array_merge($box['bar'], Skin::navigate(NULL, $prefix, $count, $items_per_page, $zoom_index));
}
// ensure that the surfer can change content
if (Articles::allow_modification($item, $anchor)) {
// view or modify this section
$menu = array();
$box['bar'] += array(Articles::get_permalink($item) => i18n::s('View the page'));
if (!is_object($overlay) || !($label = $overlay->get_label('edit_command', 'articles'))) {
$label = i18n::s('Edit this page');
}
$box['bar'] += array(Articles::get_url($item['id'], 'edit') => $label);
}
// show commands
if (count($box['bar'])) {
// commands before the box
$box['text'] = Skin::build_list($box['prefix_bar'], 'menu_bar') . $box['text'];
// append the menu bar at the end
$box['text'] .= Skin::build_list($box['bar'], 'menu_bar');
}
// build a box
if ($box['text']) {
// put a title if there are other titles or if more than 2048 chars
$title = '';
if (preg_match('/(<h1|<h2|<h3|<table|\\[title|\\[subtitle)/i', $context['text'] . $text) || strlen($context['text'] . $text) > 2048) {
$title = $title_label;
}
// insert a full box
$text .= Skin::build_box($title, $box['text'], 'header1', 'comments');
}
// assemble the full panel
$panels[] = array('att' . $item['id'], ucfirst(Skin::strip($item['title'], 30)), 'atc' . $item['id'], $text);
}
// there is some box content
if (trim($box['text'])) {
$text .= $box['text'];
}
// format tabs
$text = Skin::build_tabs($panels);
// end of processing
SQL::free($result);
return $text;
}
示例3: elseif
}
// list comments by date
$items = Comments::list_by_date_for_anchor('article:' . $item['id'], $offset, $items_per_page, $layout, TRUE);
// actually render the html
if (is_array($items)) {
$box['text'] .= Skin::build_list($items, 'rows');
} elseif (is_string($items)) {
$box['text'] .= $items;
}
// navigation commands for comments
$prefix = Comments::get_url('article:' . $item['id'], 'navigate');
$box['bar'] = array_merge($box['bar'], Skin::navigate(NULL, $prefix, $count, $items_per_page, $zoom_index));
}
// feed the wall
if ($cur_article->allows('creation', 'comment')) {
$box['text'] .= Comments::get_form('article:' . $item['id'], 'json', ucfirst(i18n::s('comment')), false);
}
// show commands
if (count($box['bar'])) {
// commands before the box
$box['text'] = Skin::build_list($box['prefix_bar'], 'menu_bar') . $box['text'];
// append the menu bar at the end
$box['text'] .= Skin::build_list($box['bar'], 'menu_bar');
}
// put the discussion in a separate panel
if (trim($box['text'])) {
$canvas['comments'] = $box['text'];
if ($count) {
$canvas['comments_count'] = $count;
}
}
示例4: switch
switch ($status) {
// an asynchronous wall
case 'yabb':
// some space with previous content
$context['text'] .= '<div style="margin-top: 2em;">';
// get a layout for comments of this item
$layout =& Comments::get_layout($anchor, $item);
$items = Comments::list_by_date_for_anchor('article:' . $item['id'], 0, 100, $layout, isset($comments_prefix));
if (is_array($items)) {
$context['text'] .= Skin::build_list($items, 'rows');
} elseif (is_string($items)) {
$context['text'] .= $items;
}
// allow for contribution
if (Comments::allow_creation($item, $anchor)) {
$context['text'] .= Comments::get_form('article:' . $item['id']);
}
$context['text'] .= '</div>';
break;
// conversation is over
// conversation is over
case 'excerpt':
// display a transcript of past comments
$items = Comments::list_by_date_for_anchor('article:' . $item['id'], 0, 500, 'excerpt');
if (is_array($items)) {
$context['text'] .= Skin::build_list($items, 'rows');
} elseif (is_string($items)) {
$context['text'] .= $items;
}
break;
// on-going conversation