本文整理汇总了PHP中url_get_full_url函数的典型用法代码示例。如果您正苦于以下问题:PHP url_get_full_url函数的具体用法?PHP url_get_full_url怎么用?PHP url_get_full_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了url_get_full_url函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: url_display_embed
/**
* Display embedded url file.
* @param object $url
* @param object $cm
* @param object $course
* @return does not return
*/
function url_display_embed($url, $cm, $course)
{
global $CFG, $PAGE, $OUTPUT;
$mimetype = resourcelib_guess_url_mimetype($url->externalurl);
$fullurl = url_get_full_url($url, $cm, $course);
$title = $url->name;
$link = html_writer::tag('a', $fullurl, array('href' => str_replace('&', '&', $fullurl)));
$clicktoopen = get_string('clicktoopen', 'url', $link);
$moodleurl = new moodle_url($fullurl);
$extension = resourcelib_get_extension($url->externalurl);
$mediamanager = core_media_manager::instance();
$embedoptions = array(core_media_manager::OPTION_TRUSTED => true, core_media_manager::OPTION_BLOCK => true);
if (in_array($mimetype, array('image/gif', 'image/jpeg', 'image/png'))) {
// It's an image
$code = resourcelib_embed_image($fullurl, $title);
} else {
if ($mediamanager->can_embed_url($moodleurl, $embedoptions)) {
// Media (audio/video) file.
$code = $mediamanager->embed_url($moodleurl, $title, 0, 0, $embedoptions);
} else {
// anything else - just try object tag enlarged as much as possible
$code = resourcelib_embed_general($fullurl, $title, $clicktoopen, $mimetype);
}
}
url_print_header($url, $cm, $course);
url_print_heading($url, $cm, $course);
echo $code;
url_print_intro($url, $cm, $course);
echo $OUTPUT->footer();
die;
}
示例2: url_export_contents
/**
* Export URL resource contents
*
* @return array of file content
*/
function url_export_contents($cm, $baseurl)
{
global $CFG, $DB;
require_once "{$CFG->dirroot}/mod/url/locallib.php";
$contents = array();
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$url = $DB->get_record('url', array('id' => $cm->instance), '*', MUST_EXIST);
$fullurl = str_replace('&', '&', url_get_full_url($url, $cm, $course));
$isurl = clean_param($fullurl, PARAM_URL);
if (empty($isurl)) {
return null;
}
$url = array();
$url['type'] = 'url';
$url['filename'] = $url->name;
$url['filepath'] = null;
$url['filesize'] = 0;
$url['fileurl'] = $fullurl;
$url['timecreated'] = null;
$url['timemodified'] = $url->timemodified;
$url['sortorder'] = null;
$url['userid'] = null;
$url['author'] = null;
$url['license'] = null;
$contents[] = $url;
return $contents;
}
示例3: url_display_embed
/**
* Display embedded url file.
* @param object $url
* @param object $cm
* @param object $course
* @param stored_file $file main file
* @return does not return
*/
function url_display_embed($url, $cm, $course)
{
global $CFG, $PAGE, $OUTPUT;
$mimetype = resourcelib_guess_url_mimetype($url->externalurl);
$fullurl = url_get_full_url($url, $cm, $course);
$title = $url->name;
$link = html_writer::tag('a', $fullurl, array('href' => str_replace('&', '&', $fullurl)));
$clicktoopen = get_string('clicktoopen', 'url', $link);
$extension = resourcelib_get_extension($url->externalurl);
if (in_array($mimetype, array('image/gif', 'image/jpeg', 'image/png'))) {
// It's an image
$code = resourcelib_embed_image($fullurl, $title);
} else {
if ($mimetype == 'audio/mp3') {
// MP3 audio file
$code = resourcelib_embed_mp3($fullurl, $title, $clicktoopen);
} else {
if ($mimetype == 'video/x-flv' or $extension === 'f4v') {
// Flash video file
$code = resourcelib_embed_flashvideo($fullurl, $title, $clicktoopen);
} else {
if ($mimetype == 'application/x-shockwave-flash') {
// Flash file
$code = resourcelib_embed_flash($fullurl, $title, $clicktoopen);
} else {
if (substr($mimetype, 0, 10) == 'video/x-ms') {
// Windows Media Player file
$code = resourcelib_embed_mediaplayer($fullurl, $title, $clicktoopen);
} else {
if ($mimetype == 'video/quicktime') {
// Quicktime file
$code = resourcelib_embed_quicktime($fullurl, $title, $clicktoopen);
} else {
if ($mimetype == 'video/mpeg') {
// Mpeg file
$code = resourcelib_embed_mpeg($fullurl, $title, $clicktoopen);
} else {
if ($mimetype == 'audio/x-pn-realaudio-plugin') {
// RealMedia file
$code = resourcelib_embed_real($fullurl, $title, $clicktoopen);
} else {
// anything else - just try object tag enlarged as much as possible
$code = resourcelib_embed_general($fullurl, $title, $clicktoopen, $mimetype);
}
}
}
}
}
}
}
}
url_print_header($url, $cm, $course);
url_print_heading($url, $cm, $course);
echo $code;
url_print_intro($url, $cm, $course);
echo $OUTPUT->footer();
die;
}
示例4: get_coursemodule_from_instance
$cm = get_coursemodule_from_instance('url', $url->id, $url->course, false, MUST_EXIST);
} else {
$cm = get_coursemodule_from_id('url', $id, 0, false, MUST_EXIST);
$url = $DB->get_record('url', array('id' => $cm->instance), '*', MUST_EXIST);
}
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
require_course_login($course, true, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('mod/url:view', $context);
add_to_log($course->id, 'url', 'view', 'view.php?id=' . $cm->id, $url->id, $cm->id);
// Update 'viewed' state if required by completion system
$completion = new completion_info($course);
$completion->set_module_viewed($cm);
$PAGE->set_url('/mod/url/view.php', array('id' => $cm->id));
if ($redirect) {
// coming from course page or url index page,
// the redirection is needed for completion tracking and logging
$fullurl = url_get_full_url($url, $cm, $course);
redirect(str_replace('&', '&', $fullurl));
}
switch (url_get_final_display_type($url)) {
case RESOURCELIB_DISPLAY_EMBED:
url_display_embed($url, $cm, $course);
break;
case RESOURCELIB_DISPLAY_FRAME:
url_display_frame($url, $cm, $course);
break;
default:
url_print_workaround($url, $cm, $course);
break;
}
示例5: unset
}
unset($exturl);
$displaytype = url_get_final_display_type($url);
if ($displaytype == RESOURCELIB_DISPLAY_OPEN) {
// For 'open' links, we always redirect to the content - except if the user
// just chose 'save and display' from the form then that would be confusing
if (!isset($_SERVER['HTTP_REFERER']) || strpos($_SERVER['HTTP_REFERER'], 'modedit.php') === false) {
$redirect = true;
}
}
if ($redirect) {
// coming from course page or url index page,
// the redirection is needed for completion tracking and logging
$fullurl = str_replace('&', '&', url_get_full_url($url, $cm, $course));
if (!course_get_format($course)->has_view_page()) {
// If course format does not have a view page, add redirection delay with a link to the edit page.
// Otherwise teacher is redirected to the external URL without any possibility to edit activity or course settings.
$editurl = null;
if (has_capability('moodle/course:manageactivities', $context)) {
$editurl = new moodle_url('/course/modedit.php', array('update' => $cm->id));
$edittext = get_string('editthisactivity');
} else if (has_capability('moodle/course:update', $context->get_course_context())) {
$editurl = new moodle_url('/course/edit.php', array('id' => $course->id));
$edittext = get_string('editcoursesettings');
}
if ($editurl) {
redirect($fullurl, html_writer::link($editurl, $edittext)."<br/>".
get_string('pageshouldredirect'), 10);
示例6: url_display_embed
/**
* Display embedded url file.
* @param object $url
* @param object $cm
* @param object $course
* @param stored_file $file main file
* @return does not return
*/
function url_display_embed($url, $cm, $course)
{
global $CFG, $PAGE;
$clicktoopen = get_string('clicktoopen', 'url', $url->externalurl);
$mimetype = resourcelib_guess_url_mimetype($url->externalurl);
$fullurl = url_get_full_url($url, $cm, $course);
$title = $url->name;
if (in_array($mimetype, array('image/gif', 'image/jpeg', 'image/png'))) {
// It's an image
$code = resourcelib_embed_image($fullurl, $title);
} else {
if ($mimetype == 'audio/mp3') {
// MP3 audio file
$code = resourcelib_embed_mp3($fullurl, $title, $clicktoopen);
} else {
if ($mimetype == 'video/x-flv') {
// Flash video file
$code = resourcelib_embed_flashvideo($fullurl, $title, $clicktoopen);
} else {
if ($mimetype == 'application/x-shockwave-flash') {
// Flash file
$code = resourcelib_embed_flash($fullurl, $title, $clicktoopen);
} else {
if (substr($mimetype, 0, 10) == 'video/x-ms') {
// Windows Media Player file
$code = resourcelib_embed_mediaplayer($fullurl, $title, $clicktoopen);
} else {
if ($mimetype == 'video/quicktime') {
// Quicktime file
$code = resourcelib_embed_quicktime($fullurl, $title, $clicktoopen);
} else {
if ($mimetype == 'video/mpeg') {
// Mpeg file
$code = resourcelib_embed_mpeg($fullurl, $title, $clicktoopen);
} else {
if ($mimetype == 'audio/x-pn-realaudio') {
// RealMedia file
$code = resourcelib_embed_real($fullurl, $title, $clicktoopen);
} else {
// anything else - just try object tag enlarged as much as possible
$code = resourcelib_embed_general($fullurl, $title, $clicktoopen, $mimetype);
$PAGE->requires->yui_lib('dom')->in_head();
$PAGE->requires->js('mod/url/functions.js')->in_head();
$PAGE->requires->js_function_call('url_init_object');
}
}
}
}
}
}
}
}
url_print_header($url, $cm, $course);
url_print_heading($url, $cm, $course);
echo $code;
url_print_intro($url, $cm, $course);
print_footer();
die;
}