Conditions | 1 |
Paths | 1 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
46 | public function getShares($url) |
||
47 | { |
||
48 | $html = file_get_contents(sprintf(self::BUTTON_URL, urlencode($url))); |
||
49 | |||
50 | // Disable libxml errors |
||
51 | $internalErrors = libxml_use_internal_errors(true); |
||
52 | $document = new \DOMDocument(); |
||
53 | $document->loadHTML(self::DTD.$html); |
||
54 | $aggregateCount = $document->getElementById('scoopit_count'); |
||
55 | |||
56 | // Restore libxml errors |
||
57 | libxml_use_internal_errors($internalErrors); |
||
58 | |||
59 | return intval($aggregateCount->nodeValue); |
||
60 | } |
||
61 | } |
||
62 |