$post->action = $action;
$strformheading = get_string('updateentrywithid', 'blog');
- if ($itemptags = html_entity_decode(tag_get_tags_csv('post', $post->id, TAG_RETURN_TEXT, 'default'))) {
+ if ($itemptags = tag_get_tags_csv('post', $post->id, TAG_RETURN_TEXT, 'default')) {
$post->ptags = $itemptags;
}
require_capability('moodle/tag:edit', $systemcontext);
// set the relatedtags field of the $tag object that will be passed to the form
-// need to use html_entity_decode because formslib does it for us later on.
-$tag->relatedtags = html_entity_decode(tag_get_related_tags_csv(tag_get_related_tags($tag->id, TAG_RELATED_MANUAL), TAG_RETURN_TEXT));
+$tag->relatedtags = tag_get_related_tags_csv(tag_get_related_tags($tag->id, TAG_RELATED_MANUAL), TAG_RETURN_TEXT);
if (can_use_html_editor()) {
$options = new object();
$tags_names = array();
foreach(tag_get_tags($record_type, $record_id, $type) as $tag) {
if ($html == TAG_RETURN_TEXT) {
- $tags_names[] = tag_display_name($tag);
+ $tags_names[] = tag_display_name($tag, TAG_RETURN_TEXT);
} else { // TAG_RETURN_HTML
$tags_names[] = '<a href="'. $CFG->wwwroot .'/tag/index.php?tag='. rawurlencode($tag->name) .'">'. tag_display_name($tag) .'</a>';
}
$tags_names = array();
foreach($related_tags as $tag) {
if ( $html == TAG_RETURN_TEXT) {
- $tags_names[] = tag_display_name($tag);
+ $tags_names[] = tag_display_name($tag, TAG_RETURN_TEXT);
} else {
// TAG_RETURN_HTML
$tags_names[] = '<a href="'. $CFG->wwwroot .'/tag/index.php?tag='. rawurlencode($tag->name) .'">'. tag_display_name($tag) .'</a>';
* Function that returns the name that should be displayed for a specific tag
*
* @param object $tag_object a line out of tag table, as returned by the adobd functions
+ * @param int $html TAG_RETURN_HTML (default) will return htmlspecialchars encoded string, TAG_RETURN_TEXT will not encode.
* @return string
*/
-function tag_display_name($tag_object) {
+function tag_display_name($tagobject, $html=TAG_RETURN_HTML) {
global $CFG;
- if(!isset($tag_object->name)) {
+ if(!isset($tagobject->name)) {
return '';
}
if (empty($CFG->keeptagnamecase)) {
//this is the normalized tag name
$textlib = textlib_get_instance();
- return htmlspecialchars($textlib->strtotitle($tag_object->name));
+ $tagname = $textlib->strtotitle($tagobject->name);
} else {
//original casing of the tag name
- return htmlspecialchars($tag_object->rawname);
+ $tagname = $tagobject->rawname;
}
+
+ if ($html == TAG_RETURN_TEXT) {
+ return $tagname;
+ } else { // TAG_RETURN_HTML
+ return htmlspecialchars($tagname);
+ }
}
/**
//user interests separated by commas
if (!empty($CFG->usetags)) {
require_once($CFG->dirroot.'/tag/lib.php');
- $user->interests = html_entity_decode(tag_get_tags_csv('user', $id, TAG_RETURN_TEXT)); // formslib uses htmlentities itself
+ $user->interests = tag_get_tags_csv('user', $id, TAG_RETURN_TEXT); // formslib uses htmlentities itself
}
//create form