Skip to content

Commit

Permalink
MDL-14237: Removing calls to html_entity_decode, along with some synt…
Browse files Browse the repository at this point in the history
…ax cleanup (merge from 1.9)
  • Loading branch information
scyrma committed Jul 7, 2008
1 parent 97f7393 commit 0c9bba1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
16 changes: 8 additions & 8 deletions blocks/tag_flickr/block_tag_flickr.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -43,21 +43,21 @@ function get_content() {
$tag = optional_param('tag', '', PARAM_TAG); // tag $tag = optional_param('tag', '', PARAM_TAG); // tag


if ($tag) { if ($tag) {
$tag_object = tag_get('name', $tag); $tagobject = tag_get('name', $tag);
} else if ($tagid) { } else if ($tagid) {
$tag_object = tag_get('id', $tagid); $tagobject = tag_get('id', $tagid);
} }


if (empty($tag_object)) { if (empty($tagobject)) {
print_error('tagnotfound'); print_error('tagnotfound');
} }


//include related tags in the photo query ? //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)) { 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 //number of photos to display
$numberofphotos = DEFAULT_NUMBER_OF_PHOTOS; $numberofphotos = DEFAULT_NUMBER_OF_PHOTOS;
Expand Down Expand Up @@ -91,12 +91,12 @@ function get_content() {
$photos = array_values($search['photoset']['photo']); $photos = array_values($search['photoset']['photo']);


} }
//search for photos tagged with $tags_csv //search for photos tagged with $tagscsv
else{ else{


$request = 'http://api.flickr.com/services/rest/?method=flickr.photos.search'; $request = 'http://api.flickr.com/services/rest/?method=flickr.photos.search';
$request .= '&api_key='.FLICKR_DEV_KEY; $request .= '&api_key='.FLICKR_DEV_KEY;
$request .= '&tags='.$tags_csv; $request .= '&tags='.$tagscsv;
$request .= '&per_page='.$numberofphotos; $request .= '&per_page='.$numberofphotos;
$request .= '&sort='.$sortby; $request .= '&sort='.$sortby;
$request .= '&format=php_serial'; $request .= '&format=php_serial';
Expand Down
22 changes: 10 additions & 12 deletions blocks/tag_youtube/block_tag_youtube.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -82,17 +82,16 @@ function get_videos_by_tag(){
$tag = optional_param('tag', '', PARAM_TAG); // tag $tag = optional_param('tag', '', PARAM_TAG); // tag


if ($tag) { if ($tag) {
$tag_object = tag_get('name', $tag); $tagobject = tag_get('name', $tag);
} else if ($tagid) { } else if ($tagid) {
$tag_object = tag_get('id', $tagid); $tagobject = tag_get('id', $tagid);
} }


if (empty($tag_object)) { if (empty($tagobject)) {
print_error('tagnotfound'); print_error('tagnotfound');
} }


$query_tag = html_entity_decode(tag_display_name($tag_object)); $querytag = urlencode($tagobject->name);
$query_tag = urlencode($query_tag);


$numberofvideos = DEFAULT_NUMBER_OF_VIDEOS; $numberofvideos = DEFAULT_NUMBER_OF_VIDEOS;
if ( !empty($this->config->numberofvideos) ) { if ( !empty($this->config->numberofvideos) ) {
Expand All @@ -101,7 +100,7 @@ function get_videos_by_tag(){


$request = 'http://www.youtube.com/api2_rest?method=youtube.videos.list_by_tag'; $request = 'http://www.youtube.com/api2_rest?method=youtube.videos.list_by_tag';
$request .= '&dev_id='. YOUTUBE_DEV_KEY; $request .= '&dev_id='. YOUTUBE_DEV_KEY;
$request .= "&tag={$query_tag}"; $request .= "&tag={$querytag}";
$request .= "&page=1"; $request .= "&page=1";
$request .= "&per_page={$numberofvideos}"; $request .= "&per_page={$numberofvideos}";


Expand All @@ -114,17 +113,16 @@ function get_videos_by_tag_and_category(){
$tag = optional_param('tag', '', PARAM_TAG); // tag $tag = optional_param('tag', '', PARAM_TAG); // tag


if ($tag) { if ($tag) {
$tag_object = tag_get('name', $tag); $tagobject = tag_get('name', $tag);
} else if ($tagid) { } else if ($tagid) {
$tag_object = tag_get('id', $tagid); $tagobject = tag_get('id', $tagid);
} }


if (empty($tag_object)) { if (empty($tagobject)) {
print_error('tagnotfound'); print_error('tagnotfound');
} }


$query_tag = html_entity_decode(tag_display_name($tag_object)); $querytag = urlencode($tagobject->name);
$query_tag = urlencode($query_tag);


$numberofvideos = DEFAULT_NUMBER_OF_VIDEOS; $numberofvideos = DEFAULT_NUMBER_OF_VIDEOS;
if( !empty($this->config->numberofvideos)) { if( !empty($this->config->numberofvideos)) {
Expand All @@ -134,7 +132,7 @@ function get_videos_by_tag_and_category(){
$request = 'http://www.youtube.com/api2_rest?method=youtube.videos.list_by_category_and_tag'; $request = 'http://www.youtube.com/api2_rest?method=youtube.videos.list_by_category_and_tag';
$request .= '&category_id='.$this->config->category; $request .= '&category_id='.$this->config->category;
$request .= '&dev_id=' . YOUTUBE_DEV_KEY; $request .= '&dev_id=' . YOUTUBE_DEV_KEY;
$request .= "&tag={$query_tag}"; $request .= "&tag={$querytag}";
$request .= "&page=1"; $request .= "&page=1";
$request .= "&per_page={$numberofvideos}"; $request .= "&per_page={$numberofvideos}";


Expand Down

0 comments on commit 0c9bba1

Please sign in to comment.