本文整理汇总了PHP中rss_add_http_header函数的典型用法代码示例。如果您正苦于以下问题:PHP rss_add_http_header函数的具体用法?PHP rss_add_http_header怎么用?PHP rss_add_http_header使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rss_add_http_header函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$url->param('parent', $parent);
}
$PAGE->set_url($url);
$discussion = $DB->get_record('forum_discussions', array('id' => $d), '*', MUST_EXIST);
$course = $DB->get_record('course', array('id' => $discussion->course), '*', MUST_EXIST);
$forum = $DB->get_record('forum', array('id' => $discussion->forum), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance('forum', $forum->id, $course->id, false, MUST_EXIST);
require_course_login($course, true, $cm);
// move this down fix for MDL-6926
require_once $CFG->dirroot . '/mod/forum/lib.php';
$modcontext = context_module::instance($cm->id);
require_capability('mod/forum:viewdiscussion', $modcontext, NULL, true, 'noviewdiscussionspermission', 'forum');
if (!empty($CFG->enablerssfeeds) && !empty($CFG->forum_enablerssfeeds) && $forum->rsstype && $forum->rssarticles) {
require_once "{$CFG->libdir}/rsslib.php";
$rsstitle = format_string($course->shortname, true, array('context' => context_course::instance($course->id))) . ': ' . format_string($forum->name);
rss_add_http_header($modcontext, 'mod_forum', $forum, $rsstitle);
}
/// move discussion if requested
if ($move > 0 and confirm_sesskey()) {
$return = $CFG->wwwroot . '/mod/forum/discuss.php?d=' . $discussion->id;
require_capability('mod/forum:movediscussions', $modcontext);
if ($forum->type == 'single') {
print_error('cannotmovefromsingleforum', 'forum', $return);
}
if (!($forumto = $DB->get_record('forum', array('id' => $move)))) {
print_error('cannotmovetonotexist', 'forum', $return);
}
if ($forumto->type == 'single') {
print_error('cannotmovetosingleforum', 'forum', $return);
}
// Get target forum cm and check it is visible to current user.
示例2: format_string
$urlparams['mode'] = $mode;
}
if ($filter) {
$urlparams['filter'] = $filter;
}
// Initialize $PAGE, compute blocks
$PAGE->set_url('/mod/data/view.php', $urlparams);
if ($edit != -1 and $PAGE->user_allowed_editing()) {
$USER->editing = $edit;
}
$courseshortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
/// RSS and CSS and JS meta
$meta = '';
if (!empty($CFG->enablerssfeeds) && !empty($CFG->data_enablerssfeeds) && $data->rssarticles > 0) {
$rsstitle = $courseshortname . ': %fullname%';
rss_add_http_header($context, 'mod_data', $data, $rsstitle);
}
if ($data->csstemplate) {
$PAGE->requires->css('/mod/data/css.php?d=' . $data->id);
}
if ($data->jstemplate) {
$PAGE->requires->js('/mod/data/js.php?d=' . $data->id, true);
}
// Mark as viewed
$completion = new completion_info($course);
$completion->set_module_viewed($cm);
/// Print the page header
// Note: MDL-19010 there will be further changes to printing header and blocks.
// The code will be much nicer than this eventually.
$title = $courseshortname . ': ' . format_string($data->name);
if ($PAGE->user_allowed_editing()) {
示例3: array
$url->param('parent', $parent);
}
$PAGE->set_url($url);
$discussion = $DB->get_record('twf_discussions', array('id' => $d), '*', MUST_EXIST);
$course = $DB->get_record('course', array('id' => $discussion->course), '*', MUST_EXIST);
$twf = $DB->get_record('twf', array('id' => $discussion->twf), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance('twf', $twf->id, $course->id, false, MUST_EXIST);
require_course_login($course, true, $cm);
// move this down fix for MDL-6926
require_once $CFG->dirroot . '/mod/twf/lib.php';
$modcontext = context_module::instance($cm->id);
require_capability('mod/twf:viewdiscussion', $modcontext, NULL, true, 'noviewdiscussionspermission', 'twf');
if (!empty($CFG->enablerssfeeds) && !empty($CFG->twf_enablerssfeeds) && $twf->rsstype && $twf->rssarticles) {
require_once "{$CFG->libdir}/rsslib.php";
$rsstitle = format_string($course->shortname, true, array('context' => context_course::instance($course->id))) . ': ' . format_string($twf->name);
rss_add_http_header($modcontext, 'mod_twf', $twf, $rsstitle);
}
// Move discussion if requested.
if ($move > 0 and confirm_sesskey()) {
$return = $CFG->wwwroot . '/mod/twf/discuss.php?d=' . $discussion->id;
if (!($twfto = $DB->get_record('twf', array('id' => $move)))) {
print_error('cannotmovetonotexist', 'twf', $return);
}
require_capability('mod/twf:movediscussions', $modcontext);
if ($twf->type == 'single') {
print_error('cannotmovefromsingletwf', 'twf', $return);
}
if (!($twfto = $DB->get_record('twf', array('id' => $move)))) {
print_error('cannotmovetonotexist', 'twf', $return);
}
if ($twfto->type == 'single') {
示例4: get_string
$straddentry = get_string("addentry", "glossary");
$strnoentries = get_string("noentries", "glossary");
$strsearchindefinition = get_string("searchindefinition", "glossary");
$strsearch = get_string("search");
$strwaitingapproval = get_string('waitingapproval', 'glossary');
/// If we are in approval mode, prit special header
$PAGE->set_title(format_string($glossary->name));
$PAGE->set_heading($course->fullname);
$url = new moodle_url('/mod/glossary/view.php', array('id' => $cm->id));
if (isset($mode)) {
$url->param('mode', $mode);
}
$PAGE->set_url($url);
if (!empty($CFG->enablerssfeeds) && !empty($CFG->glossary_enablerssfeeds) && $glossary->rsstype && $glossary->rssarticles) {
$rsstitle = format_string($course->shortname) . ': %fullname%';
rss_add_http_header($context, 'mod_glossary', $glossary, $rsstitle);
}
if ($tab == GLOSSARY_APPROVAL_VIEW) {
require_capability('mod/glossary:approve', $context);
$PAGE->navbar->add($strwaitingapproval);
echo $OUTPUT->header();
echo $OUTPUT->heading($strwaitingapproval);
} else {
/// Print standard header
echo $OUTPUT->header();
}
/// All this depends if whe have $showcommonelements
if ($showcommonelements) {
/// To calculate available options
$availableoptions = '';
/// Decide about to print the import link
示例5: array
$button = '';
if (has_capability('mod/lightboxgallery:edit', $context)) {
$url_params = array('id' => $id, 'page' => $page, 'editing' => $editing ? '0' : '1');
$url = new moodle_url('/mod/lightboxgallery/view.php', $url_params);
$strediting = get_string('turnediting' . ($editing ? 'off' : 'on'));
$button = $OUTPUT->single_button($url, $strediting, 'get') . ' ';
}
$button .= update_module_button($cm->id, $course->id, get_string('modulename', 'lightboxgallery'));
$PAGE->set_button($button);
$PAGE->requires->css('/mod/lightboxgallery/assets/skins/sam/gallery-lightbox-skin.css');
$PAGE->requires->js('/mod/lightboxgallery/gallery-lightbox-min.js');
$PAGE->requires->js('/mod/lightboxgallery/module.js');
$allowrssfeed = lightboxgallery_rss_enabled() && $gallery->rss;
$heading = get_string('displayinggallery', 'lightboxgallery', $gallery->name);
if ($allowrssfeed) {
rss_add_http_header($context, 'mod_lightboxgallery', $gallery->id, $gallery->name);
$strrsssub = get_string('rsssubscribe', 'lightboxgallery');
$heading .= ' ' . rss_get_link($context->id, $userid, 'mod_lightboxgallery', $gallery->id, $strrsssub);
}
echo $OUTPUT->header();
echo $OUTPUT->heading($heading);
if ($gallery->intro && !$editing) {
echo $OUTPUT->box(format_module_intro('lightboxgallery', $gallery, $cm->id), 'generalbox', 'intro');
}
echo $OUTPUT->box_start('generalbox lightbox-gallery clearfix');
$fs = get_file_storage();
$stored_files = $fs->get_area_files($context->id, 'mod_lightboxgallery', 'gallery_images');
$image_count = 1;
foreach ($stored_files as $stored_file) {
if (!$stored_file->is_valid_image()) {
continue;
示例6: set_page_rss
/**
* Sets the dataform page rss.
*
* @return void
*/
protected function set_page_rss()
{
global $CFG;
if (!empty($CFG->enablerssfeeds) and !empty($CFG->dataform_enablerssfeeds)) {
// Get rss views and add http header for each one.
if ($rssviews = $this->get_rss_views()) {
require_once "{$CFG->libdir}/rsslib.php";
foreach ($rssviews as $viewid => $view) {
$rsstitle = $view->get_rss_header_title();
// Format_string($this->course->shortname) . ': %fullname%';
$componentinstance = $this->id . "/{$viewid}";
rss_add_http_header($this->context, 'mod_dataform', $componentinstance, $rsstitle);
}
}
}
}
示例7: render_discussionsview
/**
* Render all discussions view, including add discussion button, etc...
*
* @param stdClass $forum - forum row
* @return string
*/
public function render_discussionsview($forum)
{
global $CFG, $DB, $PAGE, $SESSION;
ob_start();
// YAK! todo, fix this rubbish.
require_once $CFG->dirroot . '/mod/hsuforum/lib.php';
require_once $CFG->libdir . '/completionlib.php';
require_once $CFG->libdir . '/accesslib.php';
$output = '';
$modinfo = get_fast_modinfo($forum->course);
$forums = $modinfo->get_instances_of('hsuforum');
if (!isset($forums[$forum->id])) {
print_error('invalidcoursemodule');
}
$cm = $forums[$forum->id];
$id = $cm->id;
// Forum instance id (id in course modules table)
$f = $forum->id;
// Forum ID
$config = get_config('hsuforum');
if ($id) {
if (!($course = $DB->get_record("course", array("id" => $cm->course)))) {
print_error('coursemisconf');
}
} else {
if ($f) {
if (!($course = $DB->get_record("course", array("id" => $forum->course)))) {
print_error('coursemisconf');
}
// move require_course_login here to use forced language for course
// fix for MDL-6926
require_course_login($course, true, $cm);
} else {
print_error('missingparameter');
}
}
$context = \context_module::instance($cm->id);
if (!empty($CFG->enablerssfeeds) && !empty($config->enablerssfeeds) && $forum->rsstype && $forum->rssarticles) {
require_once "{$CFG->libdir}/rsslib.php";
$rsstitle = format_string($course->shortname, true, array('context' => \context_course::instance($course->id))) . ': ' . format_string($forum->name);
rss_add_http_header($context, 'mod_hsuforum', $forum, $rsstitle);
}
// Mark viewed if required
$completion = new \completion_info($course);
$completion->set_module_viewed($cm);
/// Some capability checks.
if (empty($cm->visible) and !has_capability('moodle/course:viewhiddenactivities', $context)) {
notice(get_string("activityiscurrentlyhidden"));
}
if (!has_capability('mod/hsuforum:viewdiscussion', $context)) {
notice(get_string('noviewdiscussionspermission', 'hsuforum'));
}
$params = array('context' => $context, 'objectid' => $forum->id);
$event = \mod_hsuforum\event\course_module_viewed::create($params);
$event->add_record_snapshot('course_modules', $cm);
$event->add_record_snapshot('course', $course);
$event->add_record_snapshot('hsuforum', $forum);
$event->trigger();
if (!defined(AJAX_SCRIPT) || !AJAX_SCRIPT) {
// Return here if we post or set subscription etc (but not if we are calling this via ajax).
$SESSION->fromdiscussion = qualified_me();
}
$PAGE->requires->js_init_call('M.mod_hsuforum.init', null, false, $this->get_js_module());
$output .= $this->svg_sprite();
$this->view($course, $cm, $forum, $context);
// Don't allow non logged in users, or guest to try to manage subscriptions.
if (isloggedin() && !isguestuser()) {
$url = new \moodle_url('/mod/hsuforum/index.php', ['id' => $course->id]);
$manageforumsubscriptions = get_string('manageforumsubscriptions', 'mod_hsuforum');
$output .= \html_writer::link($url, $manageforumsubscriptions);
}
$output = ob_get_contents() . $output;
ob_end_clean();
return $output;
}
示例8: require_course_login
require_course_login($course, true, $cm);
$strquoras = get_string("modulenameplural", "quora");
$strquora = get_string("modulename", "quora");
} else {
print_error('missingparameter');
}
}
if (!$PAGE->button) {
$PAGE->set_button(quora_search_form($course, $search));
}
$context = context_module::instance($cm->id);
$PAGE->set_context($context);
if (!empty($CFG->enablerssfeeds) && !empty($CFG->quora_enablerssfeeds) && $quora->rsstype && $quora->rssarticles) {
require_once "{$CFG->libdir}/rsslib.php";
$rsstitle = format_string($course->shortname, true, array('context' => context_course::instance($course->id))) . ': ' . format_string($quora->name);
rss_add_http_header($context, 'mod_quora', $quora, $rsstitle);
}
/// Print header.
$PAGE->set_title($quora->name);
$PAGE->add_body_class('quoratype-' . $quora->type);
$PAGE->set_heading($course->fullname);
/// Some capability checks.
if (empty($cm->visible) and !has_capability('moodle/course:viewhiddenactivities', $context)) {
notice(get_string("activityiscurrentlyhidden"));
}
if (!has_capability('mod/quora:viewdiscussion', $context)) {
notice(get_string('noviewdiscussionspermission', 'quora'));
}
// Mark viewed and trigger the course_module_viewed event.
quora_view($quora, $course, $cm, $context);
echo $OUTPUT->header();
示例9: require_course_login
require_course_login($course, true, $cm);
$stranonforums = get_string("modulenameplural", "anonforum");
$stranonforum = get_string("modulename", "anonforum");
} else {
print_error('missingparameter');
}
}
if (!$PAGE->button) {
$PAGE->set_button(anonforum_search_form($course, $search));
}
$context = context_module::instance($cm->id);
$PAGE->set_context($context);
if (!empty($CFG->enablerssfeeds) && !empty($CFG->anonforum_enablerssfeeds) && $anonforum->rsstype && $anonforum->rssarticles) {
require_once "{$CFG->libdir}/rsslib.php";
$rsstitle = format_string($course->shortname, true, array('context' => context_course::instance($course->id))) . ': ' . format_string($anonforum->name);
rss_add_http_header($context, 'mod_anonforum', $anonforum, $rsstitle);
}
// Mark viewed if required.
$completion = new completion_info($course);
$completion->set_module_viewed($cm);
// Print header.
$PAGE->set_title($anonforum->name);
$PAGE->add_body_class('anonforumtype-' . $anonforum->type);
$PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
/// Some capability checks.
if (empty($cm->visible) and !has_capability('moodle/course:viewhiddenactivities', $context)) {
notice(get_string("activityiscurrentlyhidden"));
}
if (!has_capability('mod/anonforum:viewdiscussion', $context)) {
notice(get_string('noviewdiscussionspermission', 'anonforum'));