<commit_before>CakePHP Social Share
====================

This plugin provides a CakePHP 2.x View helper for creating links to share content on numerous social networks and bookmarking sites.

The aim of the plugin is to keep things simple. It doesn't come packaged with any JavaScript and I leave design decisions up to you. You can choose whether you want to use text, images, sprites or an icon font for your links.

Social Share currently supports Delicious, Digg, Evernote, Facebook, Friend Feed, Google Bookmarks, Google+, LinkedIn, Newsvine, Pinterest, Pocket, Reddit Slashdot, simple email, StumbleUpon, Technorati, Tumblr and Twitter.

Installation
------------

Install using composer: `composer require drmonkeyninja/cakephp-social-share:~2.0`

Alternatively, you can manually copy the plugin to your app/Plugin directory and rename the plugin's directory 'SocialShare'.

Then add the following line to your bootstrap.php to load the plugin.
```php
CakePlugin::load('SocialShare');
```

Also don't forget to add the helper in your controller:
```php
public $helpers = array('SocialShare.SocialShare');
```

Usage
-----

### SocialShareHelper::link()
```
SocialShareHelper::link(string $service, string $title, mixed $url = null, array $options = array())
```

Returns an HTML link to share the current page for the supplied service. For example to create a link for Facebook:
```php
echo $this->SocialShare->link(
	'facebook',
	__('Share on Facebook')
);
```

You can easily produce a list of links to share to different social networks:
```php
$services = array(
	'facebook' => __('Share on Facebook'),
	'gplus' => __('Share on Google+'),
	'linkedin' => __('Share on LinkedIn'),
	'twitter' => __('Share on Twitter')
);

echo '<ul>';
foreach ($services as $service => $linkText) {
	echo '<li>' . $this->SocialShare->link(
		$service,
		$linkText
	) . '</li>';
}
echo '</ul>';
```

Supported services:

* delicious
* digg
* email
* evernote
* facebook
* friendfeed
* google (Google Bookmarks)
* gplus (Google+)
* linkedin
* newsvine
* pinterest
* pocket
* reddit
* slashdot
* stumbleupon
* technorati
* tumblr
* twitter

You can pass a URL or a routing array as the third parameter for the URL you want to share.

$options supports the same options as `HtmlHelper::link()` as well as a 'text' option for a page title you want to include when sharing the URL. For Pinterest there is an additional 'image' option for a URL to an image to share.

### SocialShareHelper::href()
```
SocialShareHelper::href(string $service, mixed $url = null, array $options = array())
```

Returns an URL for sharing to the supplied service.

### SocialShareHelper::fa()
```
SocialShareHelper::fa(string $service, mixed $url = null, array $options = array())<commit_msg>Updated the readme file to add reference to whatsapp.<commit_after>CakePHP Social Share
====================

This plugin provides a CakePHP 2.x View helper for creating links to share content on numerous social networks and bookmarking sites.

The aim of the plugin is to keep things simple. It doesn't come packaged with any JavaScript and I leave design decisions up to you. You can choose whether you want to use text, images, sprites or an icon font for your links.

Social Share currently supports Delicious, Digg, Evernote, Facebook, Friend Feed, Google Bookmarks, Google+, LinkedIn, Newsvine, Pinterest, Pocket, Reddit Slashdot, simple email, StumbleUpon, Technorati, Tumblr, Twitter and WhatsApp.

Installation
------------

Install using composer: `composer require drmonkeyninja/cakephp-social-share:~2.0`

Alternatively, you can manually copy the plugin to your app/Plugin directory and rename the plugin's directory 'SocialShare'.

Then add the following line to your bootstrap.php to load the plugin.
```php
CakePlugin::load('SocialShare');
```

Also don't forget to add the helper in your controller:
```php
public $helpers = array('SocialShare.SocialShare');
```

Usage
-----

### SocialShareHelper::link()
```
SocialShareHelper::link(string $service, string $title, mixed $url = null, array $options = array())
```

Returns an HTML link to share the current page for the supplied service. For example to create a link for Facebook:
```php
echo $this->SocialShare->link(
	'facebook',
	__('Share on Facebook')
);
```

You can easily produce a list of links to share to different social networks:
```php
$services = array(
	'facebook' => __('Share on Facebook'),
	'gplus' => __('Share on Google+'),
	'linkedin' => __('Share on LinkedIn'),
	'twitter' => __('Share on Twitter')
);

echo '<ul>';
foreach ($services as $service => $linkText) {
	echo '<li>' . $this->SocialShare->link(
		$service,
		$linkText
	) . '</li>';
}
echo '</ul>';
```

Supported services:

* delicious
* digg
* email
* evernote
* facebook
* friendfeed
* google (Google Bookmarks)
* gplus (Google+)
* linkedin
* newsvine
* pinterest
* pocket
* reddit
* slashdot
* stumbleupon
* technorati
* tumblr
* twitter
* whatsapp

You can pass a URL or a routing array as the third parameter for the URL you want to share.

$options supports the same options as `HtmlHelper::link()` as well as a 'text' option for a page title you want to include when sharing the URL. For Pinterest there is an additional 'image' option for a URL to an image to share.

### SocialShareHelper::href()
```
SocialShareHelper::href(string $service, mixed $url = null, array $options = array())
```

Returns an URL for sharing to the supplied service.

### SocialShareHelper::fa()
```
SocialShareHelper::fa(string $service, mixed $url = null, array $options = array())
{'fraction_non_alphanumeric': 0.12242337336440222, 'fraction_numerical': 0.0010754615522495072, 'mean_word_length': 4.818561001042753, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1707524', 'n_tokens_mistral': 1653, 'n_tokens_neox': 1537, 'n_words': 697}