Skip to content

Commit

Permalink
MDL-21240 more migration to html_writer
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Jan 18, 2010
1 parent 77774f6 commit f2ab0d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
12 changes: 2 additions & 10 deletions lib/ajax/ajaxlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,8 @@ public function __construct(page_requirements_manager $manager, $url) {
}

public function get_html() {
return ajax_get_link_to_script($this->url);
$attributes = array('type'=>'text/javascript', 'src'=>$this->url);
return html_writer::tag('script', $attributes, '') . "\n";
}

/**
Expand Down Expand Up @@ -1276,15 +1277,6 @@ public function get_js_code() {
}
}

/**
* Return the HTML required to link to a JavaScript file.
* @param $url the URL of a JavaScript file.
* @return string the required HTML.
*/
function ajax_get_link_to_script($url) {
return '<script type="text/javascript" src="' . $url . '"></script>' . "\n";
}


/**
* Returns whether ajax is enabled/allowed or not.
Expand Down
3 changes: 2 additions & 1 deletion lib/filelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2076,7 +2076,8 @@ function file_modify_html_header($text) {
$ufo = '';
if (filter_is_enabled('filter/mediaplugin')) {
// this script is needed by most media filter plugins.
$ufo = ajax_get_link_to_script($CFG->wwwroot . '/lib/ufo.js');
$attributes = array('type'=>'text/javascript', 'src'=>$CFG->httpswwwroot . '/lib/ufo.js');
$ufo = html_writer::tag('script', $attributes, '') . "\n";
}

preg_match('/\<head\>|\<HEAD\>/', $text, $matches);
Expand Down

0 comments on commit f2ab0d0

Please sign in to comment.