MDL-21233 simplifying moodle_url->out() api

This commit is contained in:
Petr Skoda
2010-01-17 09:18:11 +00:00
parent a4a04ada39
commit 340d461269
10 changed files with 15 additions and 13 deletions
+1 -1
View File
@@ -897,7 +897,7 @@ class block_manager {
// it is shortened because some web servers (e.g. IIS by default) give
// a 'security' error if you try to pass a full URL as a GET parameter in another URL.
$return = $this->out(false, array(), false);
$return = $this->out_raw();
$return = str_replace($CFG->wwwroot . '/', '', $return);
$controls[] = array('url' => $CFG->wwwroot . '/' . $CFG->admin .
+1 -1
View File
@@ -75,7 +75,7 @@ class tinymce_texteditor extends texteditor {
$strtime = get_string('strftimetime');
$strdate = get_string('strftimedaydate');
$lang = str_replace('_utf8', '', current_language()); // use more standard language codes
$contentcss = $PAGE->theme->editor_css_url()->out(false, array(), false);
$contentcss = $PAGE->theme->editor_css_url()->out_raw();
$context = empty($options['context']) ? get_context_instance(CONTEXT_SYSTEM) : $options['context'];
if (!empty($options['legacy'])) {
+1 -1
View File
@@ -132,7 +132,7 @@ class popup_action extends component_action {
$this->params[$var] = $params[$var];
}
}
parent::__construct($event, 'openpopup', array('url' => $url->out(false, array(), false), 'name' => $name, 'options' => $this->get_js_options($params)));
parent::__construct($event, 'openpopup', array('url' => $url->out_raw(), 'name' => $name, 'options' => $this->get_js_options($params)));
}
/**
+2 -2
View File
@@ -740,7 +740,7 @@ class core_renderer extends renderer_base {
foreach ($controls as $control) {
$controlshtml[] = html_writer::tag('a', array('class' => 'icon',
'title' => $control['caption'], 'href' => $control['url']),
html_writer::empty_tag('img', array('src' => $this->pix_url($control['icon'])->out(false, array(), false),
html_writer::empty_tag('img', array('src' => $this->pix_url($control['icon'])->out_raw(),
'alt' => $control['caption'])));
}
return html_writer::tag('div', array('class' => 'commands'), implode('', $controlshtml));
@@ -820,7 +820,7 @@ class core_renderer extends renderer_base {
$plaintitle = strip_tags($bc->title);
$this->page->requires->js_function_call('new block_hider', array($bc->id, $userpref,
get_string('hideblocka', 'access', $plaintitle), get_string('showblocka', 'access', $plaintitle),
$this->pix_url('t/switch_minus')->out(false, array(), false), $this->pix_url('t/switch_plus')->out(false, array(), false)));
$this->pix_url('t/switch_minus')->out_raw(), $this->pix_url('t/switch_plus')->out_raw()));
}
}
+1 -1
View File
@@ -999,7 +999,7 @@ class moodle_page {
if (empty($this->_block_actions_done)) {
$this->_block_actions_done = true;
if ($this->blocks->process_url_actions($this)) {
redirect($this->url->out(false, array(), false));
redirect($this->url->out_raw());
}
}
$this->blocks->create_all_block_instances();
+1 -1
View File
@@ -319,7 +319,7 @@ class portfolio_add_button {
}
// if we just want a url to redirect to, do it now
if ($format == PORTFOLIO_ADD_FAKE_URL) {
return $url->out(false, array(), false);
return $url->out_raw();
}
if (empty($addstr)) {
+3 -3
View File
@@ -647,7 +647,7 @@ function prepare_url($url, $stripformparams=false) {
if (preg_match('/(.*)\/([A-Za-z0-9-_]*\.php)$/', $PAGE->url->out(true), $matches)) {
return $matches[1] . "/$output";
} else if ($output == '') {
return $PAGE->url->out(false, array(), false) . '#';
return $PAGE->url->out_raw() . '#';
} else {
throw new coding_exception('Unrecognied URL scheme. Please check the formatting of the URL passed to this function. Absolute URLs are the preferred scheme.');
}
@@ -2071,7 +2071,7 @@ function print_collapsible_region_start($classes, $id, $caption, $userpref = fal
$output .= '</div><div id="' . $id . '_inner" class="collapsibleregioninner">';
$PAGE->requires->js_function_call('new collapsible_region',
array($id, $userpref, get_string('clicktohideshow'),
$OUTPUT->pix_url('t/collapsed')->out(false, null, false), $OUTPUT->pix_url('t/expanded')->out(false, null, false)));
$OUTPUT->pix_url('t/collapsed')->out_raw(), $OUTPUT->pix_url('t/expanded')->out_raw()));
if ($return) {
return $output;
@@ -2475,7 +2475,7 @@ function redirect($url, $message='', $delay=-1) {
global $OUTPUT, $PAGE, $SESSION, $CFG;
if ($url instanceof moodle_url) {
$url = $url->out(false, array(), false);
$url = $url->out_raw();
}
if (!empty($CFG->usesid) && !isset($_COOKIE[session_name()])) {
+1 -1
View File
@@ -66,7 +66,7 @@ class workshop_random_allocator implements workshop_allocator {
$customdata['workshop'] = $this->workshop;
$this->mform = new workshop_random_allocator_form($PAGE->url, $customdata);
if ($this->mform->is_cancelled()) {
redirect($PAGE->url->out(false, array(), false));
redirect($PAGE->url->out_raw());
} else if ($settings = $this->mform->get_data()) {
// process validated data
if (!confirm_sesskey()) {
+2 -1
View File
@@ -800,8 +800,9 @@ class question_bank_view {
}
// Create the url of the new question page to forward to.
// TODO: it is sloppy to pass around full URLs through page parameters and some servers do not like that
$this->editquestionurl = new moodle_url("$CFG->wwwroot/question/question.php",
array('returnurl' => urlencode($pageurl->out(false, array(), false))));
array('returnurl' => urlencode($pageurl->out_raw())));
if ($cm !== null){
$this->editquestionurl->param('cmid', $cm->id);
} else {
+2 -1
View File
@@ -218,7 +218,8 @@ if ($mform->is_cancelled()){
/// Ensure we redirect back to the category the question is being saved into.
$returnurl = new moodle_url($returnurl);
$returnurl->param('category', $fromform->category);
$returnurl = $returnurl->out(false, array(), false);
// TODO: it is sloppy to pass arounf full URLs through page parameters and some servers do not like that
$returnurl = $returnurl->out_raw();
/// Call the appropriate method.
if ($movecontext) {