本文整理汇总了PHP中Versions::count_for_anchor方法的典型用法代码示例。如果您正苦于以下问题:PHP Versions::count_for_anchor方法的具体用法?PHP Versions::count_for_anchor怎么用?PHP Versions::count_for_anchor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Versions
的用法示例。
在下文中一共展示了Versions::count_for_anchor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
// owners can do what they want
if ($cur_article->allows('modification')) {
Surfer::empower();
} elseif (Surfer::is_logged() && is_object($anchor) && $anchor->is_assigned()) {
Surfer::empower('S');
} elseif (isset($item['id']) && $cur_article->is_assigned() && Surfer::is_logged()) {
Surfer::empower('S');
}
// is the article on user watch list?
$in_watch_list = FALSE;
if (isset($item['id']) && Surfer::get_id()) {
$in_watch_list = Members::check('article:' . $item['id'], 'user:' . Surfer::get_id());
}
// has this page some versions?
$has_versions = FALSE;
if (isset($item['id']) && !$zoom_type && Surfer::is_empowered() && Versions::count_for_anchor('article:' . $item['id'])) {
$has_versions = TRUE;
}
// load the skin, maybe with a variant
load_skin('article', $anchor, isset($item['options']) ? $item['options'] : '');
// clear the tab we are in
if (is_object($anchor)) {
$context['current_focus'] = $anchor->get_focus();
}
// current item
if (isset($item['id'])) {
$context['current_item'] = 'article:' . $item['id'];
}
// path to this page
if ($whole_rendering) {
$context['path_bar'] = Surfer::get_path_bar($anchor);
示例2: urlencode
}
// page tools
//
// update tools
if (Files::allow_modification($item, $anchor)) {
// modify this page
Skin::define_img('FILES_EDIT_IMG', 'files/edit.gif');
$context['page_tools'][] = Skin::build_link(Files::get_url($item['id'], 'edit'), FILES_EDIT_IMG . i18n::s('Update this file'), 'basic', i18n::s('Press [e] to edit'), FALSE, 'e');
// post an image, if upload is allowed
if (Images::allow_creation($item, $anchor, 'file')) {
Skin::define_img('IMAGES_ADD_IMG', 'images/add.gif');
$context['page_tools'][] = Skin::build_link('images/edit.php?anchor=' . urlencode('file:' . $item['id']), IMAGES_ADD_IMG . i18n::s('Add an image'), 'basic');
}
}
// restore a previous version, if any
if (is_object($anchor) && $anchor->is_owned() && Versions::count_for_anchor('file:' . $item['id'])) {
Skin::define_img('FILES_VERSIONS_IMG', 'files/versions.gif');
$context['page_tools'][] = Skin::build_link(Versions::get_url('file:' . $item['id'], 'list'), FILES_VERSIONS_IMG . i18n::s('Versions'));
}
// delete command provided to associates and owners
if (is_object($anchor) && $anchor->is_owned() || Surfer::is_associate()) {
Skin::define_img('FILES_DELETE_IMG', 'files/delete.gif');
$context['page_tools'][] = Skin::build_link(Files::get_url($item['id'], 'delete'), FILES_DELETE_IMG . i18n::s('Delete this file'));
}
// the navigation sidebar
$text = '';
if (is_object($anchor)) {
$neighbours = $anchor->get_neighbours('file', $item);
$text .= Skin::neighbours($neighbours, 'sidebar');
}
// build a nice sidebar box
示例3: get_ics
/**
* get event description in ICS format
*
* @param string either 'PUBLISH', 'REQUEST', 'CANCEL', ...
* @return string content of the ICS
*
* @see articles/invite.php
* @see overlays/events/fetch_ics.php
*/
function get_ics($method = 'PUBLISH')
{
global $context;
// begin calendar
$text = 'BEGIN:VCALENDAR' . CRLF . 'VERSION:2.0' . CRLF . 'PRODID:' . $context['host_name'] . CRLF;
// method
$text .= 'METHOD:' . $method . CRLF;
// begin event
$text .= 'BEGIN:VEVENT' . CRLF;
// date of creation
if ($value = $this->anchor->get_value('create_date')) {
$text .= 'DTSTAMP:' . gmdate('Ymd\\THis\\Z', SQL::strtotime($value)) . CRLF;
}
// date of last modification --also required by Outlook
if ($value = $this->anchor->get_value('edit_date')) {
$text .= 'LAST-MODIFICATION:' . gmdate('Ymd\\THis\\Z', SQL::strtotime($value)) . CRLF;
}
// the event spans limited time --duration is expressed in minutes
if (isset($this->attributes['duration']) && $this->attributes['duration'] && $this->attributes['duration'] < 1440) {
$text .= 'DTSTART:' . str_replace(array('-', ' ', ':'), array('', 'T', ''), $this->attributes['date_stamp']) . 'Z' . CRLF;
$text .= 'DTEND:' . gmdate('Ymd\\THis\\Z', SQL::strtotime($this->attributes['date_stamp']) + $this->attributes['duration'] * 60) . CRLF;
// a full-day event
} elseif (isset($this->attributes['date_stamp'])) {
$text .= 'DTSTART;VALUE=DATE:' . date('Ymd', SQL::strtotime($this->attributes['date_stamp'])) . CRLF;
$text .= 'DTEND;VALUE=DATE:' . date('Ymd', SQL::strtotime($this->attributes['date_stamp']) + 86400) . CRLF;
}
// url to view the date
$text .= 'URL:' . $context['url_to_home'] . $context['url_to_root'] . $this->anchor->get_url() . CRLF;
// location is the yacs server
$text .= 'LOCATION:' . $context['host_name'] . CRLF;
// build a valid title
if ($value = $this->anchor->get_title()) {
$text .= 'SUMMARY:' . Codes::beautify_title($value) . CRLF;
}
// description is partially automated
$text .= 'DESCRIPTION:';
if ($value = $this->anchor->get_title()) {
$text .= sprintf(i18n::s('%s: %s'), i18n::s('Topic'), str_replace(array("\n", "\r"), ' ', Codes::beautify_title($value))) . '\\n';
}
// dates
if (isset($this->attributes['date_stamp']) && $this->attributes['date_stamp']) {
$text .= sprintf(i18n::s('%s: %s'), i18n::s('Date'), Skin::build_date($this->attributes['date_stamp'], 'standalone')) . '\\n';
}
if (isset($this->attributes['duration']) && $this->attributes['duration'] && $this->attributes['duration'] < 1440) {
$text .= sprintf(i18n::s('%s: %s'), i18n::s('Duration'), $this->attributes['duration'] . ' ' . i18n::s('minutes')) . '\\n';
}
// build a link to the chairman page, if any
if (isset($this->attributes['chairman']) && ($user = Users::get($this->attributes['chairman']))) {
$text .= sprintf(i18n::s('%s: %s'), i18n::s('Chairman'), $user['full_name']) . '\\n';
} elseif (($owner = $this->anchor->get_value('owner_id')) && ($user = Users::get($owner))) {
$text .= sprintf(i18n::s('%s: %s'), i18n::s('Chairman'), $user['full_name']) . '\\n';
}
// location
if ($method != 'CANCEL') {
$text .= sprintf(i18n::s('%s: %s'), i18n::s('Location'), $context['url_to_home'] . $context['url_to_root'] . $this->anchor->get_url()) . '\\n';
}
// meeting has been cancelled
if ($method == 'CANCEL') {
$text .= '\\n\\n' . i18n::c('Meeting has been cancelled.');
// regular meeting
} else {
// copy content of the introduction field, if any
if ($value = $this->anchor->get_value('introduction')) {
$text .= '\\n' . strip_tags(str_replace(array('</', '/>', "\n", "\r", ','), array('\\n</', '/>\\n', '\\n', ' ', '\\,'), Codes::beautify($value)));
}
// copy the induction message, if any
if (isset($this->attributes['induction_message'])) {
$text .= '\\n' . strip_tags(str_replace(array('</', '/>', "\n", "\r", ','), array('\\n</', '/>\\n', '\\n', ' ', '\\,'), Codes::render($this->attributes['induction_message'])));
}
}
// end of the description field
$text .= CRLF;
// may be used for updates or for cancellation --required by Outlook 2003
$text .= 'UID:' . crc32($this->anchor->get_reference() . ':' . $context['url_to_root']) . '@' . $context['host_name'] . CRLF;
// maybe this one has been cancelled
if ($method == 'CANCEL') {
$text .= 'STATUS:CANCELLED' . CRLF;
}
// sequence is incremented on each revision
include_once $context['path_to_root'] . 'versions/versions.php';
$versions = Versions::count_for_anchor($this->anchor->get_reference());
$text .= 'SEQUENCE:' . $versions . CRLF;
// more attributes
$text .= 'PRIORITY:5' . CRLF . 'TRANSP:OPAQUE' . CRLF . 'CLASS:PUBLIC' . CRLF;
// alarm to remind the meeting
if ($method != 'CANCEL') {
$text .= 'BEGIN:VALARM' . CRLF . 'TRIGGER:-PT15M' . CRLF . 'DESCRIPTION:Reminder' . CRLF . 'ACTION:DISPLAY' . CRLF . 'END:VALARM' . CRLF;
}
// close event
$text .= 'END:VEVENT' . CRLF;
// close calendar
//.........这里部分代码省略.........