Skip to content

Commit

Permalink
Merge pull request #3 from Mark-H/patch-3
Browse files Browse the repository at this point in the history
Add some sanity checking
  • Loading branch information
Christian Seel committed Apr 16, 2012
2 parents e53b150 + c2306e9 commit d99bbf7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fblikes.snippet.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
$graphdata = file_get_contents("http://graph.facebook.com/".$pageid);
// decode json response
$response = $modx->fromJSON($graphdata);
if (!$response || !is_array($response) || !isset($response['likes'])) {
return 'Data currently not available.';
}
// get like number
$data = $response['likes'];

Expand Down

0 comments on commit d99bbf7

Please sign in to comment.