MDL-8270 full block backup/restore - based on patches by Mark Nielsen and code in...
[moodle.git] / blocks / html / block_html.php
CommitLineData
86db09ef 1<?php //$Id$
2
3class block_html extends block_base {
4
5 function init() {
6 $this->title = get_string('html', 'block_html');
433c242f 7 $this->version = 2007101509;
86db09ef 8 }
9
b959599b 10 function applicable_formats() {
11 return array('all' => true);
12 }
13
86db09ef 14 function specialization() {
48f7fa4a 15 $this->title = isset($this->config->title) ? $this->config->title : get_string('newhtmlblock', 'block_html');
86db09ef 16 }
17
18 function instance_allow_multiple() {
19 return true;
20 }
21
22 function get_content() {
86db09ef 23 if ($this->content !== NULL) {
24 return $this->content;
25 }
26
e345909c 27 $filteropt = new stdClass;
28 $filteropt->noclean = true;
29
86db09ef 30 $this->content = new stdClass;
e345909c 31 $this->content->text = isset($this->config->text) ? format_text($this->config->text, FORMAT_HTML, $filteropt) : '';
86db09ef 32 $this->content->footer = '';
33
e345909c 34 unset($filteropt); // memory footprint
35
86db09ef 36 return $this->content;
37 }
43457dc8 38
39 function backup_encode_absolute_links_in_config(&$config) {
40 $config->text = backup_encode_absolute_links($config->text);
41 }
42
43 function restore_decode_absolute_links_in_config(&$config) {
43457dc8 44 $oldtext = $config->text;
45 $config->text = restore_decode_absolute_links($oldtext);
46 return $config->text != $oldtext;
47 }
86db09ef 48}
49?>