getShares() public method

Gets the number of share of the given URL on the given provider.
public getShares ( string $providerName, string $url, boolean $delayUpdate = false ) : integer
$providerName string
$url string
$delayUpdate boolean
return integer
Exemplo n.º 1
0
 /**
  * @param string $provider
  * @param string $url
  *
  * @return int
  * @throws \RuntimeException             If requested provider is undefined
  * @throws UnsupportedOperationException If called for an uncompatible provider
  */
 public function getShareCount($provider, $url)
 {
     return $this->socialShare->getShares($provider, $url);
 }
Exemplo n.º 2
0
$socialShare->registerProvider(new Google());
$socialShare->registerProvider(new Pinterest());
$socialShare->registerProvider(new LinkedIn());
$socialShare->registerProvider(new ScoopIt());
$socialShare->registerProvider(new StumbleUpon());
$socialShare->registerProvider(new Tumblr());
?>

<ul>
    <li>
        <a href="<?php 
echo htmlspecialchars($socialShare->getLink(Facebook::NAME, 'https://dunglas.fr'));
?>
">
            Share on Facebook (<?php 
echo $socialShare->getShares(Facebook::NAME, 'https://dunglas.fr');
?>
)
        </a>
    </li>

    <li>
        <a href="<?php 
echo htmlspecialchars($socialShare->getLink(Twitter::NAME, 'https://dunglas.fr', array('via' => '@dunglas', 'text' => 'Kévin Dunglas\' SocialShare library')));
?>
">
            Share on Twitter (<?php 
echo $socialShare->getShares(Twitter::NAME, 'https://dunglas.fr');
?>
)
        </a>