filamentgroup/SocialCount — pull request #19 by ddrager (2013-01-10 16:13:40+00:00)
Title: Improvements and security fixes

Howdy,

Just implemented this on my site. Made a few improvements so thought I would pass them through.

* Added sanitization of the passed url. Not having this sanitized could spell problems with file_get_contents.
* Changed Facebook url. I was often not getting numbers back when I should have. Moving to Facebook FQL solved this. There are different values you can choose from, but I thought total_count was most appropriate. See: https://developers.facebook.com/docs/reference/fql/link_stat
* Added referrer checking of the url. If this check is not done you can check any other site with this script. While CSRF checks prevent this from a usability standpoint, it could still be used to harvest data using your resources (and API limits).

I noted a few other things, but I'll open up an issue for those as I've coded solutions for my implementation but it may not work for everyone.

```
dave@dave-VirtualBox:~/Desktop/SocialCount/test$ phpunit socialcount_service_test.php
PHPUnit 3.7.12 by Sebastian Bergmann.

......

Time: 1 second, Memory: 4.75Mb

OK (6 tests, 12 assertions)
```