Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-31562: Implemented support for exporting labels, minor additional

cleanups
  • Loading branch information...
commit 5b6d8a05f427bc0f8a71f0cabf958fce0c6478fa 1 parent baa5cd8
Darko Miletic authored
View
1  backup/cc/cc_includes.php
@@ -39,4 +39,5 @@
require_once($CFG->dirroot .'/backup/cc/cc_lib/cc_converter_resource.php');
require_once($CFG->dirroot .'/backup/cc/cc_lib/cc_converter_quiz.php');
require_once($CFG->dirroot .'/backup/cc/cc_lib/cc_converter_page.php');
+require_once($CFG->dirroot .'/backup/cc/cc_lib/cc_converter_label.php');
require_once($CFG->dirroot .'/backup/cc/cc_lib/cc_convert_moodle2.php');
View
2  backup/cc/cc_lib/cc_asssesment.php
@@ -1821,7 +1821,7 @@ public function set_section(cc_assesment_section $object) {
}
public function set_title($value) {
- $this->assessment_title = $value;
+ $this->assessment_title = self::safexml($value);
}
protected function on_save() {
View
8 backup/cc/cc_lib/cc_basiclti.php
@@ -55,10 +55,10 @@ class basicltil1_resurce_file extends general_cc_file {
protected $cartridge_icon = null;
public function set_title($title) {
- $this->title = $title;
+ $this->title = self::safexml($title);
}
public function set_description($description) {
- $this->description = $description;
+ $this->description = self::safexml($description);
}
public function set_launch_url ($url) {
$this->launch_url = $url;
@@ -77,11 +77,11 @@ public function set_vendor_code ($code) {
$this->vendor = true;
}
public function set_vendor_name ($name) {
- $this->vendor_name = $name;
+ $this->vendor_name = self::safexml($name);
$this->vendor = true;
}
public function set_vendor_description ($desc) {
- $this->vendor_description = $desc;
+ $this->vendor_description = self::safexml($desc);
$this->vendor = true;
}
public function set_vendor_url ($url) {
View
39 backup/cc/cc_lib/cc_converter_label.php
@@ -0,0 +1,39 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * @package backup-convert
+ * @subpackage cc-library
+ * @copyright 2012 Darko Miletic <dmiletic@moodlerooms.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+require_once 'cc_converters.php';
+require_once 'cc_general.php';
+
+class cc_converter_label extends cc_converter {
+
+ public function __construct(cc_i_item &$item, cc_i_manifest &$manifest, $rootpath, $path){
+ $this->defaultfile = 'label.xml';
+ parent::__construct($item, $manifest, $rootpath, $path);
+ }
+
+ public function convert($outdir) {
+ $resitem = new cc_item();
+ $resitem->title = $this->doc->nodeValue('/activity/label/name');
+ $this->item->add_child_item($resitem);
+ return true;
+ }
+}
View
4 backup/cc/cc_lib/cc_forum.php
@@ -37,11 +37,11 @@ class forum1_resurce_file extends general_cc_file {
protected $attachments = array();
public function set_title($title) {
- $this->title = $title;
+ $this->title = self::safexml($title);
}
public function set_text($text, $type='text/plain') {
- $this->text = $text;
+ $this->text = self::safexml($text);
$this->text_type = $type;
}
View
4 backup/cc/cc_lib/cc_page.php
@@ -35,11 +35,11 @@ public function set_content($value) {
}
public function set_title($value) {
- $this->title = $value;
+ $this->title = self::safexml($value);
}
public function set_intro($value) {
- $this->intro = htmlspecialchars(strip_tags($value), ENT_COMPAT, 'UTF-8', false);
+ $this->intro = self::safexml(strip_tags($value));
}
protected function on_create() {
View
2  backup/cc/cc_lib/cc_weblink.php
@@ -44,7 +44,7 @@ class url1_resurce_file extends general_cc_file {
* @param string $title
*/
public function set_title($title) {
- $this->title = htmlentities($title);
+ $this->title = self::safexml($title);
}
/**
View
12 backup/cc/cc_lib/xmlbase.php
@@ -41,6 +41,18 @@ class XMLGenericDocument {
private $is_html = false;
+ /**
+ * @param string $value
+ * @return string
+ */
+ public static function safexml($value) {
+ $result = htmlspecialchars(html_entity_decode($value, ENT_QUOTES, 'UTF-8'),
+ ENT_NOQUOTES,
+ 'UTF-8',
+ false);
+ return $result;
+ }
+
function __construct($ch = 'UTF-8',$validatenow=true){
$this->charset = $ch;
$this->documentInit();
Please sign in to comment.
Something went wrong with that request. Please try again.