contributte / social
Social plugins for Nette Framework
Fund package maintenance!
f3l1x
contributte.org/partners.html
Installs: 56 892
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 4
Forks: 5
Open Issues: 0
pkg:composer/contributte/social
Requires
- php: >=8.1
- nette/application: ^3.1.14
- nette/utils: ^4.0.0
Requires (Dev)
- contributte/phpstan: ^0.1
- contributte/qa: ^0.4
- contributte/tester: ^0.3
README
Website 🚀 contributte.org | Contact 👨🏻💻 f3l1x.io | Twitter 🐦 @contributte
Disclaimer
| ⚠️ | This project is no longer being maintained. |
|---|
| Composer | contributte/social |
|---|---|
| Version | |
| PHP | |
| License |
Documentation
Content
Collection of facebook components for Nette 2.4.0.
Plugins
| Plugin | Source | Docs |
|---|---|---|
| Like Button | source | doc |
| Share Button | source | doc |
| Send Button | source | doc |
| Embedded Posts | source | doc |
| Embedded Videos | source | doc |
| Follow Button | source | doc |
| Comments | source | doc |
| Page Plugin | source | doc |
Deprecated
| Plugin | Source | Docs |
|---|---|---|
| Activity Feed | source | doc |
| Recommendations Feed | source | doc |
| Like Box | source | doc |
| Facepile | source | doc |
Usage
Presenter
use Contributte\Social\Facebook\LikeButton; use Contributte\Social\Facebook\Script; protected function createComponentLikeButton() { $button = new LikeButton(); $attrs = $button->getAttributes(); // URL - manually $attrs->add('data-url', $this->link('Home:default')); // URL - current $attrs->add('data-url', $this->link('//this')); // Add other attributes $attrs->add('data-layout', $button::LAYOUT_BUTTON_COUNT); // OR $attrs->data('layout', $button::LAYOUT_BUTTON_COUNT); return $button; } protected function createComponentScript() { $script = new Script(); $script->setApiVersion("v2.6"); $script->setAppId(123456); return $script; }
Template
You have to display JavaScript code.
{control likebutton} {control script}
Google +1
Settings
| Type | Field | Default | Setter/Getter | Info |
|---|---|---|---|---|
| string | $size |
standard | yes/yes | |
| string | $annotation |
inline | yes/yes | inline/bubble/none |
| string | $callback |
NULL | yes/yes | |
| string | $url |
NULL | yes/yes | |
| int | $mode |
default | yes/yes | default/explicit/dynamic |
| int | $width |
300 | yes/yes | |
| string | $lang |
cs | yes/yes | |
| Html | $elementPrototype |
div class="g-plusone" | yes/yes | html prototype |
| array | $properties |
[] | yes/yes |
Factory
use Contributte\Social\Google\PlusOne; protected function createComponentPlusone() { $button = new PlusOne(); $button->setMode($button::MODE_DEFAULT); $button->setUrl('www.google.com'); return $button; }
/** @var Contributte\Social\Google\IPlusOneFactory @inject */ public $plusOneFactory; protected function createComponentPlusone() { $button = $this->plusOneFactory->create(); $button->setMode($button::MODE_DEFAULT); $button->setUrl('www.google.com'); return $button; }
Template
Render javascript
Place before </body> or </head>.
{control plusone:js}
Render button
Button #1: {control plusone}
Button #2: {control plusone, $url}
Button #3: {control plusone, 'www.seznam.com'}
Google Analytics Campaign Maker
Small utility for creating GA accepted parameters to url.
Parameters
- source
- medium
- campaign
- term
- content
Usage
use Contributte\Social\Google\Analytics\Campaign; // Source, medium, campaign $campaign = new Campaign('newsletter', 'website', 'april13'); $this->link('Card:detail', $campaign->build()); // Source, medium, campaign, term, content $campaign = new Campaign('newsletter', 'website', 'april13', 'term1', 'content'); $this->link('Product:detail', $campaign->build()); // Factory (same args as previous) $link = Campaign::create('newsletter', 'website', 'april13'); $this->link('Foto:detail', $link);
TweetButton
Settings
| Type | Field | Default | Setter/Getter | Info |
|---|---|---|---|---|
| string | $url |
NULL | yes/yes | |
| string | $href |
https://twitter.com/share | yes/yes | |
| string | $via |
NULL | yes/yes | |
| string | $text |
NULL | yes/yes | |
| string | $related |
NULL | yes/yes | |
| string | $count |
vertical | yes/yes | none/vertical/horizontal |
| string | $counturl |
NULL | yes/yes | |
| array | $hashtags |
[] | yes/yes | |
| string | $size |
medium | yes/yes | medium/large |
| bool | $dnt |
FALSE | yes/yes | |
| string | $lang |
cs | yes/yes | |
| Html | $elementPrototype |
a | yes/yes | html prototype |
| string | $elementText |
Tweet | yes/yes | |
| array | $properties |
[] | yes/yes |
Helpers
setShareButton($text)setMentionButton($mention)setHashtagButton($hashtag)
Factory
config.neon
services: - Contributte\Social\Twitter\ITweetButtonFactory
Presenter
use Contributte\Social\Twitter\TweetButton; /** * @return TweetButton */ protected function createComponentPlusone() { $button = new TweetButton(); $button->setShareButton('www.google.com'); return $button; }
/** @var Contributte\Social\Twitter\ITweetButtonFactory @inject */ public $twitterFactory; /** * @return TweetButton */ protected function createComponentTwitter() { $button = $this->twitterFactory->create(); $button->setShareButton('www.google.com'); return $button; }
Template
Render javascript
Place before </body> or </head>.
{control twitter:js}
Render button
Button #1: {control twitter}
Button #2: {control twitter, $url}
Button #3: {control twitter, 'www.seznam.com'}
Development
This package was maintained by these authors.
Consider to support contributte development team. Also thank you for using this package.