# share-button/1.16/classes/network/pinterest.php

Social Share Buttons, version 1.16. 48 lines.

- Page: https://pluginprobe.com/plugins/share-button/1.16/code/classes/network/pinterest.php
- Raw: https://pluginprobe.com/plugins/share-button/1.16/raw/classes/network/pinterest.php
- Modified: 2021-04-15T10:53:24+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/share-button/1.16/code/classes/network/pinterest.php#L10-L20`.

```php
<?php
namespace MBSocial;


class pinterestNetwork extends mbNetwork
{
	protected $network = 'pinterest';
	protected $icon = 'fa-pinterest';
	protected $priority = 'readmore';
	protected $color = '#cb2027';

	public function __construct()
	{
		$this->label = __('Share', 'mbsocial');
		$this->share_url = 'https://www.pinterest.com/pin/create/bookmarklet/?media={img}&url={url}&is_video=false&description={title}';
		$this->count_api = 'https://api.pinterest.com/v1/urls/count.json?url={url}';
		$this->profile_url = 'http://www.pinterest.com/{profile}';
		$this->countable = true;
		$this->return_var = 'count';
		$this->popup_dimensions = array(750, 500);
		parent::__construct();

	}

	public function remoteRequest($url)
	{
		$response = wp_remote_get($url);

		if (is_wp_error($response) || $response['response']['code'] != 200) {
				return false;
			}
		else {
				$result = wp_remote_retrieve_body($response);
		}

	 	// remove the callback wrapper.
	 	$result = str_replace("receiveCount(","",$result);
	 	$result = substr($result,0,(strlen($result) -1) ); // remove last char.
	 	$json = json_decode($result, true);

	 	if (isset($json["count"]))
	 		return $json["count"];

		return 0;
	}

}

```
