Skip to content

Commit

Permalink
[TASK] Update Shariff frontend to version 1.15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hlubek committed Jul 10, 2015
1 parent 7bc4af1 commit dad2bf5
Show file tree
Hide file tree
Showing 17 changed files with 265 additions and 112 deletions.
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "Resources/Public"
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/Resources/Public/jquery
/Resources/Public/shariff
!/Resources/Public/shariff/build/*
53 changes: 53 additions & 0 deletions Classes/Networkteam/Neos/Shariff/BackendFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
namespace Networkteam\Neos\Shariff;

/***************************************************************
* (c) 2015 networkteam GmbH - all rights reserved
***************************************************************/

use TYPO3\Flow\Annotations as Flow;
use TYPO3\Flow\Http\Uri;

class BackendFactory {

/**
* @Flow\Inject(setting="options")
* @var array
*/
protected $options;

/**
* @Flow\Inject(setting="http.baseUri", package="TYPO3.Flow")
* @var string
*/
protected $baseUri;

/**
* @var array
*/
protected $supportedServices = array('Facebook', 'Flattr', 'GooglePlus', 'LinkedIn', 'Pinterest', 'Reddit', 'Twitter', 'Xing');

/**
* Auto-detect the domain (if not set) and restrict services to available backends
*/
public function initializeObject() {
if (!isset($this->options['domain']) || $this->options['domain'] === NULL) {
$request = \TYPO3\Flow\Http\Request::createFromEnvironment();
if ((string)$this->baseUri !== '') {
$request->setBaseUri(new Uri($this->baseUri));
}
$this->options['domain'] = $request->getBaseUri()->getHost();
}
$this->options['services'] = array_intersect($this->options['services'], $this->supportedServices);
}

/**
* @return \Heise\Shariff\Backend
*/
public function create() {
return new \Heise\Shariff\Backend(
$this->options
);
}

}
1 change: 0 additions & 1 deletion Configuration/NodeTypes.Shariff.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

'Networkteam.Neos.Shariff:Shariff':
superTypes:
'TYPO3.Neos:Content': true
Expand Down
6 changes: 3 additions & 3 deletions Configuration/Objects.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Heise\Shariff\Backend:
arguments:
1:
setting: Networkteam.Neos.Shariff.options
scope: singleton
factoryObjectName: Networkteam\Neos\Shariff\BackendFactory
factoryMethodName: create
4 changes: 2 additions & 2 deletions Configuration/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ Networkteam:
orientation: horizontal
language: en
options:
domain: 'your-domain.tld'
domain: ~
cache:
ttl: 1
ttl: 3600
services:
# - Facebook
# - GooglePlus
Expand Down
48 changes: 27 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ Networkteam.Neos.Shariff
========================

Social plugins are on every page today, but if you have concerns about privacy of your visitors it is not that easy
to integrate them. The german computer magazin C`t created together with the publisher heise a general solution
also providing the number of shares each social button counts can be shown. This is accomplished by using the
server of the website as proxy for the visitors. http://ct.de/-2467514
to integrate them. The german publisher Heise created a general solution that allows to show the counts for each share
while preserving the privacy of website visitory. This is accomplished by using the server of the website as proxy for
the visitors. http://ct.de/-2467514

This plugin integrates shariff into neos with a few simple steps.
This plugin integrates Shariff into Neos with a few simple steps.

Installation:
-------------
Expand All @@ -16,40 +16,46 @@ Installation:
Configuration:
--------------

Include the routing from the package to enable shariff to communicate to the server to fetch the counts.
Include the package routes in your *global* `Routes.yaml` for fetching the counts via AJAX:

Routes.yaml
-
name: 'NetworkteamNeosShariff'
uriPattern: 'shariff/<NetworkteamNeosShariffSubroutes>'
subRoutes:
NetworkteamNeosShariffSubroutes:
package: Networkteam.Neos.Shariff

Configure the list of services to show in a `Settings.yaml` (e.g. in your site package):

Next you need to configure the domain this site runs on, this is to prevent using you server as open relay for the
requests.


Settings.yaml
Networkteam:
Neos:
Sharrif:
Shariff:
options:
domain: <your domain name here>
services:
- WhatsApp
- Twitter
- Facebook
- GooglePlus
- Pinterest
- Mail

See `Configuration/Settings.yaml` for more information about possible options.

There are more options here, for example to configure which plugins to show, for more settings check the Settings.yaml
inside the plugin.
Usage:
------

Usage via TypoScript 2
----------------------
This package contains a simple Node Type `Networkteam.Neos.Shariff:Shariff` that renders social
share buttons via Shariff. Just add a new node of this type to a document in the Neos backend.

Usage via TypoScript:
---------------------

In your prototype define a property which renders the social plugins like this:

In the TypoScript2 Object define a property which should contain the social plugins like this:

prototype(My.Awesome.Package:Post) {
socialButtons = Networkteam.Neos.Shariff:Shariff
}
Then in the corresponding Template render the path like this

Then in the corresponding template render the path like this:

{socialButtons -> f:format.raw()}
4 changes: 2 additions & 2 deletions Resources/Private/TypoScript/Root.ts2
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ prototype(TYPO3.Neos:Page) {
tagName = 'script'
attributes {
src = TYPO3.TypoScript:ResourceUri {
path = 'resource://Networkteam.Neos.Shariff/Public/Scripts/shariff.min.js'
path = 'resource://Networkteam.Neos.Shariff/Public/shariff/build/shariff.min.js'
}
}
}
Expand All @@ -16,7 +16,7 @@ prototype(TYPO3.Neos:Page) {
attributes {
rel = 'stylesheet'
href = TYPO3.TypoScript:ResourceUri {
path = 'resource://Networkteam.Neos.Shariff/Public/Css/shariff.complete.css'
path = 'resource://Networkteam.Neos.Shariff/Public/shariff/build/shariff.complete.css'
}
}
}
Expand Down
1 change: 0 additions & 1 deletion Resources/Public/Css/shariff.complete.css

This file was deleted.

1 change: 0 additions & 1 deletion Resources/Public/Css/shariff.min.css

This file was deleted.

Loading

0 comments on commit dad2bf5

Please sign in to comment.