@@ 5-44 (lines=40) @@ | ||
2 | ||
3 | namespace SocialLinks\Providers; |
|
4 | ||
5 | class Pinterest extends ProviderBase implements ProviderInterface |
|
6 | { |
|
7 | /** |
|
8 | * {@inheritdoc} |
|
9 | */ |
|
10 | public function shareUrl() |
|
11 | { |
|
12 | return $this->buildUrl( |
|
13 | 'https://www.pinterest.com/pin/create/button/', |
|
14 | array( |
|
15 | 'url', |
|
16 | 'title' => 'description', |
|
17 | 'image' => 'media', |
|
18 | ) |
|
19 | ); |
|
20 | } |
|
21 | ||
22 | /** |
|
23 | * {@inheritdoc} |
|
24 | */ |
|
25 | public function shareCountRequest() |
|
26 | { |
|
27 | return static::request( |
|
28 | $this->buildUrl( |
|
29 | 'https://api.pinterest.com/v1/urls/count.json', |
|
30 | array('url') |
|
31 | ) |
|
32 | ); |
|
33 | } |
|
34 | ||
35 | /** |
|
36 | * {@inheritdoc} |
|
37 | */ |
|
38 | public function shareCount($response) |
|
39 | { |
|
40 | $count = static::jsonpResponse($response); |
|
41 | ||
42 | return isset($count['count']) ? intval($count['count']) : 0; |
|
43 | } |
|
44 | } |
|
45 |
@@ 5-43 (lines=39) @@ | ||
2 | ||
3 | namespace SocialLinks\Providers; |
|
4 | ||
5 | class Stumbleupon extends ProviderBase implements ProviderInterface |
|
6 | { |
|
7 | /** |
|
8 | * {@inheritdoc} |
|
9 | */ |
|
10 | public function shareUrl() |
|
11 | { |
|
12 | return $this->buildUrl( |
|
13 | 'https://www.stumbleupon.com/submit', |
|
14 | array( |
|
15 | 'url', |
|
16 | 'title', |
|
17 | ) |
|
18 | ); |
|
19 | } |
|
20 | ||
21 | /** |
|
22 | * {@inheritdoc} |
|
23 | */ |
|
24 | public function shareCountRequest() |
|
25 | { |
|
26 | return static::request( |
|
27 | $this->buildUrl( |
|
28 | 'http://www.stumbleupon.com/services/1.01/badge.getinfo', |
|
29 | array('url') |
|
30 | ) |
|
31 | ); |
|
32 | } |
|
33 | ||
34 | /** |
|
35 | * {@inheritdoc} |
|
36 | */ |
|
37 | public function shareCount($response) |
|
38 | { |
|
39 | $count = static::jsonResponse($response); |
|
40 | ||
41 | return isset($count['result']['views']) ? intval($count['result']['views']) : 0; |
|
42 | } |
|
43 | } |
|
44 |
@@ 5-52 (lines=48) @@ | ||
2 | ||
3 | namespace SocialLinks\Providers; |
|
4 | ||
5 | class Xing extends ProviderBase implements ProviderInterface |
|
6 | { |
|
7 | /** |
|
8 | * {@inheritdoc} |
|
9 | */ |
|
10 | public function shareUrl() |
|
11 | { |
|
12 | ||
13 | /* |
|
14 | * alternate request url: |
|
15 | * https://www.xing-share.com/app/user?op=share;sc_p=xing-share;url=YOUR-URL |
|
16 | */ |
|
17 | ||
18 | return $this->buildUrl( |
|
19 | 'https://www.xing.com/spi/shares/new', |
|
20 | array( |
|
21 | 'url' |
|
22 | ) |
|
23 | ); |
|
24 | } |
|
25 | ||
26 | /** |
|
27 | * {@inheritdoc} |
|
28 | */ |
|
29 | public function shareCountRequest() |
|
30 | { |
|
31 | $url = $this->buildUrl( |
|
32 | 'https://www.xing-share.com/app/share', |
|
33 | array('url'), |
|
34 | array( |
|
35 | "op" => "get_share_button", |
|
36 | "counter" => 'top' |
|
37 | ) |
|
38 | ); |
|
39 | ||
40 | return static::request($url); |
|
41 | } |
|
42 | ||
43 | /** |
|
44 | * {@inheritdoc} |
|
45 | */ |
|
46 | public function shareCount($response) |
|
47 | { |
|
48 | preg_match('/xing-count(.+?)(\d+)(.*?)<\/span>/i', $response, $matches); |
|
49 | ||
50 | return (int)$matches[2]; |
|
51 | } |
|
52 | } |
|
53 |