本文整理匯總了PHP中Sections::list_watchers_by_name方法的典型用法代碼示例。如果您正苦於以下問題:PHP Sections::list_watchers_by_name方法的具體用法?PHP Sections::list_watchers_by_name怎麽用?PHP Sections::list_watchers_by_name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sections
的用法示例。
在下文中一共展示了Sections::list_watchers_by_name方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: elseif
}
// an anchor is mandatory
if (!is_object($anchor)) {
Logger::error(i18n::s('No anchor has been found.'));
} elseif (!$permitted) {
Safe::header('Status: 401 Unauthorized', TRUE, 401);
Logger::error(i18n::s('You are not allowed to perform this operation.'));
// list all watchers
} elseif ($permitted == 'watchers') {
// page title
$context['page_title'] = sprintf(i18n::s('Watchers of %s'), $anchor->get_title());
// watchers of a page
if (!strncmp($anchor->get_reference(), 'article:', 8)) {
$users = Articles::list_watchers_by_name($anchor->item, 0, 5 * USERS_LIST_SIZE, 'raw');
} elseif (!strncmp($anchor->get_reference(), 'section:', 8)) {
$users = Sections::list_watchers_by_name($anchor->item, 0, 5 * USERS_LIST_SIZE, 'raw');
} else {
$anchors = array($anchor->get_reference());
$handle = $anchor->get_parent();
while ($handle && ($parent = Anchors::get($handle))) {
$anchors[] = $handle;
$handle = $parent->get_parent();
}
// authorized users
$restricted = NULL;
if ($anchor->is_hidden() && ($editors =& Members::list_anchors_for_member($anchors))) {
foreach ($editors as $editor) {
if (strpos($editor, 'user:') === 0) {
$restricted[] = substr($editor, strlen('user:'));
}
}
示例2: htmlspecialchars
$actual_names[] = htmlspecialchars($recipient);
}
}
Mailer::close();
// display the list of actual recipients
if ($actual_names) {
$context['text'] .= '<div>' . sprintf(i18n::s('Your message is being transmitted to %s'), Skin::finalize_list($actual_names, 'compact')) . '</div>';
} else {
$context['text'] .= '<p>' . i18n::s('No message has been sent') . '</p>';
}
// back to the section page
$menu = array();
$menu[] = Skin::build_link(Sections::get_permalink($item), i18n::s('Done'), 'button');
$context['text'] .= Skin::finalize_list($menu, 'assistant_bar');
// recipients are watchers of this section (including parent sections)
} elseif (!($recipients = Sections::list_watchers_by_name($item, 0, 1000, 'mail'))) {
Logger::error(i18n::s('No recipient has been found.'));
// display the form
} else {
// the form to send a message
$context['text'] .= '<form method="post" action="' . $context['script_url'] . '" onsubmit="return validateDocumentPost(this)" id="main_form"><div>';
// build a nice list of recipients
$label = i18n::s('Message recipients');
$input = Skin::build_box(i18n::s('Select recipients'), $recipients, 'folded');
$fields[] = array($label, $input);
// the subject
$label = i18n::s('Message title');
$title = sprintf(i18n::c('Notification: %s'), $item['title']);
$input = '<input type="text" name="subject" id="subject" size="70" value="' . encode_field($title) . '" />';
$fields[] = array($label, $input);
// default message content