PHP code example of hostbox / nette-component-social-plugins
1. Go to this page and download the library: Download hostbox/nette-component-social-plugins library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hostbox / nette-component-social-plugins example snippets
use HostBox\Components\Facebook\SocialPlugins\LikeBox;
use HostBox\Components\Google\SocialPlugins\GoogleFactory;
use HostBox\Components\Google\SocialPlugins\PlusOneButton;
use HostBox\Components\Pinterest\SocialPlugins\PinItButton;
use HostBox\Components\Pinterest\SocialPlugins\PinterestFactory;
use HostBox\Components\Twitter\SocialPlugins\FollowButton;
use HostBox\Components\Twitter\SocialPlugins\TwitterFactory;
class HomepagePresenter extends BasePresenter {
/** @var FacebookFactory */
protected $facebookFactory;
/** @var TwitterFactory */
protected $twitterFactory;
/** @var GoogleFactory */
protected $googleFactory;
/** @var PinterestFactory */
protected $pinterestFactory;
/**
* @var LinkedInFactory
* @inject
*/
public $linkedInFactory;
public function __construct(FacebookFactory $facebookFactory, TwitterFactory $twitterFactory, GoogleFactory $googleFactory, PinterestFactory $pinterestFactory) {
$this->facebookFactory = $facebookFactory;
$this->twitterFactory = $twitterFactory;
$this->googleFactory = $googleFactory;
$this->pinterestFactory = $pinterestFactory;
}
// component create by Factory
public function createComponentFacebookLikeButton() {
return $this->facebookFactory->createLikeButton();
}
// default settings by factory function parameter
public function createComponentFacebookLikeBox() {
return $this->facebookFactory->createLikeBox(array(
'colorScheme' => LikeBox::COLOR_SCHEME_DARK,
'showFaces' => TRUE
));
}
// by component function parameter
public function createComponentTwitterShareButton() {
$component = $this->twitterFactory->createFollowButton();
$component->assign(array(
'size' => FollowButton::SIZE_LARGE,
'showCount' => TRUE
));
return $component;
}
// by component variable
public function createComponentGooglePlusOneButton() {
$component = $this->googleFactory->createPlusOneButton();
$component->size = PlusOneButton::SIZE_SMALL;
return $component;
}
public function createComponentLinkedInShareButton() {
return $this->linkedInFactory->createShareButton();
}
public function createComponentPinterestFollowButton() {
return $this->pinterestFactory->createFollowButton(array(
'userName' => 'pinterest',
'text' => 'Pinterest'
));
}
}