diff options
author | Bart Visscher <bartv@thisnet.nl> | 2011-09-23 22:22:59 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2011-09-25 22:19:28 +0200 |
commit | 17e631bc5e327514596ce8761fe7f93d414a8717 (patch) | |
tree | a2e6bed923a493988028adafaaebcab5b9bfbd39 /apps/media | |
parent | dbddec9160338818009ec7020cec5a2b298aae7e (diff) | |
download | nextcloud-server-17e631bc5e327514596ce8761fe7f93d414a8717.tar.gz nextcloud-server-17e631bc5e327514596ce8761fe7f93d414a8717.zip |
Use OC_JSON for json responses
Create OC_JSON class, for single point of creating json responses.
No real logic change, this just cleans up the code a bit.
Diffstat (limited to 'apps/media')
-rw-r--r-- | apps/media/ajax/api.php | 12 | ||||
-rw-r--r-- | apps/media/ajax/autoupdate.php | 4 | ||||
-rw-r--r-- | apps/media/tomahawk.php | 4 |
3 files changed, 10 insertions, 10 deletions
diff --git a/apps/media/ajax/api.php b/apps/media/ajax/api.php index c5909e4c78b..84ee6334463 100644 --- a/apps/media/ajax/api.php +++ b/apps/media/ajax/api.php @@ -67,7 +67,7 @@ if($arguments['action']){ $data['artists']=OC_MEDIA_COLLECTION::getArtists(); $data['albums']=OC_MEDIA_COLLECTION::getAlbums(); $data['songs']=OC_MEDIA_COLLECTION::getSongs(); - echo json_encode($data); + OC_JSON::encodedPrint($data); break; case 'scan': OC_DB::beginTransaction(); @@ -81,13 +81,13 @@ if($arguments['action']){ echo (OC_MEDIA_SCANNER::scanFile($arguments['path']))?'true':'false'; break; case 'get_artists': - echo json_encode(OC_MEDIA_COLLECTION::getArtists($arguments['search'])); + OC_JSON::encodedPrint(OC_MEDIA_COLLECTION::getArtists($arguments['search'])); break; case 'get_albums': - echo json_encode(OC_MEDIA_COLLECTION::getAlbums($arguments['artist'],$arguments['search'])); + OC_JSON::encodedPrint(OC_MEDIA_COLLECTION::getAlbums($arguments['artist'],$arguments['search'])); break; case 'get_songs': - echo json_encode(OC_MEDIA_COLLECTION::getSongs($arguments['artist'],$arguments['album'],$arguments['search'])); + OC_JSON::encodedPrint(OC_MEDIA_COLLECTION::getSongs($arguments['artist'],$arguments['album'],$arguments['search'])); break; case 'get_path_info': if(OC_Filesystem::file_exists($arguments['path'])){ @@ -100,7 +100,7 @@ if($arguments['action']){ $song=OC_MEDIA_COLLECTION::getSong($songId); $song['artist']=OC_MEDIA_COLLECTION::getArtistName($song['song_artist']); $song['album']=OC_MEDIA_COLLECTION::getAlbumName($song['song_album']); - echo json_encode($song); + OC_JSON::encodedPrint($song); } } break; @@ -129,7 +129,7 @@ if($arguments['action']){ OC_Filesystem::readfile($arguments['path']); exit; case 'find_music': - echo json_encode(findMusic()); + OC_JSON::encodedPrint(findMusic()); exit; } } diff --git a/apps/media/ajax/autoupdate.php b/apps/media/ajax/autoupdate.php index ac3d0650b4b..ad103d1c39b 100644 --- a/apps/media/ajax/autoupdate.php +++ b/apps/media/ajax/autoupdate.php @@ -35,5 +35,5 @@ if(defined("DEBUG") && DEBUG) {error_log((integer)$autoUpdate);} OC_Preferences::setValue(OC_User::getUser(),'media','autoupdate',(integer)$autoUpdate); -echo json_encode( array( "status" => "success", "data" => $autoUpdate)); -?>
\ No newline at end of file +OC_JSON::success(array('data' => $autoUpdate)); +?> diff --git a/apps/media/tomahawk.php b/apps/media/tomahawk.php index bf0c2c2a756..1db982a3504 100644 --- a/apps/media/tomahawk.php +++ b/apps/media/tomahawk.php @@ -77,5 +77,5 @@ foreach($songs as $song) { 'score' => (float)1.0 ); } -echo json_encode($results); -?>
\ No newline at end of file +OC_JSON::encodedPrint($results); +?> |