Commit 0c9bba1c authored by scyrma's avatar scyrma
Browse files

MDL-14237: Removing calls to html_entity_decode, along with some syntax cleanup (merge from 1.9)

parent 97f7393d
......@@ -43,21 +43,21 @@ class block_tag_flickr extends block_base {
$tag = optional_param('tag', '', PARAM_TAG); // tag
if ($tag) {
$tag_object = tag_get('name', $tag);
$tagobject = tag_get('name', $tag);
} else if ($tagid) {
$tag_object = tag_get('id', $tagid);
$tagobject = tag_get('id', $tagid);
}
if (empty($tag_object)) {
if (empty($tagobject)) {
print_error('tagnotfound');
}
//include related tags in the photo query ?
$tags_csv = html_entity_decode(tag_display_name($tag_object));
$tagscsv = $tagobject->name;
if (!empty($this->config->includerelatedtags)) {
$tags_csv .= ',' . tag_get_related_tags_csv(tag_get_related_tags($tag_object->id), TAG_RETURN_TEXT);
$tagscsv .= ',' . tag_get_related_tags_csv(tag_get_related_tags($tagobject->id), TAG_RETURN_TEXT);
}
$tags_csv = urlencode($tags_csv);
$tagscsv = urlencode($tagscsv);
//number of photos to display
$numberofphotos = DEFAULT_NUMBER_OF_PHOTOS;
......@@ -91,12 +91,12 @@ class block_tag_flickr extends block_base {
$photos = array_values($search['photoset']['photo']);
}
//search for photos tagged with $tags_csv
//search for photos tagged with $tagscsv
else{
$request = 'http://api.flickr.com/services/rest/?method=flickr.photos.search';
$request .= '&api_key='.FLICKR_DEV_KEY;
$request .= '&tags='.$tags_csv;
$request .= '&tags='.$tagscsv;
$request .= '&per_page='.$numberofphotos;
$request .= '&sort='.$sortby;
$request .= '&format=php_serial';
......
......@@ -82,17 +82,16 @@ class block_tag_youtube extends block_base {
$tag = optional_param('tag', '', PARAM_TAG); // tag
if ($tag) {
$tag_object = tag_get('name', $tag);
$tagobject = tag_get('name', $tag);
} else if ($tagid) {
$tag_object = tag_get('id', $tagid);
$tagobject = tag_get('id', $tagid);
}
if (empty($tag_object)) {
if (empty($tagobject)) {
print_error('tagnotfound');
}
$query_tag = html_entity_decode(tag_display_name($tag_object));
$query_tag = urlencode($query_tag);
$querytag = urlencode($tagobject->name);
$numberofvideos = DEFAULT_NUMBER_OF_VIDEOS;
if ( !empty($this->config->numberofvideos) ) {
......@@ -101,7 +100,7 @@ class block_tag_youtube extends block_base {
$request = 'http://www.youtube.com/api2_rest?method=youtube.videos.list_by_tag';
$request .= '&dev_id='. YOUTUBE_DEV_KEY;
$request .= "&tag={$query_tag}";
$request .= "&tag={$querytag}";
$request .= "&page=1";
$request .= "&per_page={$numberofvideos}";
......@@ -114,17 +113,16 @@ class block_tag_youtube extends block_base {
$tag = optional_param('tag', '', PARAM_TAG); // tag
if ($tag) {
$tag_object = tag_get('name', $tag);
$tagobject = tag_get('name', $tag);
} else if ($tagid) {
$tag_object = tag_get('id', $tagid);
$tagobject = tag_get('id', $tagid);
}
if (empty($tag_object)) {
if (empty($tagobject)) {
print_error('tagnotfound');
}
$query_tag = html_entity_decode(tag_display_name($tag_object));
$query_tag = urlencode($query_tag);
$querytag = urlencode($tagobject->name);
$numberofvideos = DEFAULT_NUMBER_OF_VIDEOS;
if( !empty($this->config->numberofvideos)) {
......@@ -134,7 +132,7 @@ class block_tag_youtube extends block_base {
$request = 'http://www.youtube.com/api2_rest?method=youtube.videos.list_by_category_and_tag';
$request .= '&category_id='.$this->config->category;
$request .= '&dev_id=' . YOUTUBE_DEV_KEY;
$request .= "&tag={$query_tag}";
$request .= "&tag={$querytag}";
$request .= "&page=1";
$request .= "&per_page={$numberofvideos}";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment