Skip to content

Commit

Permalink
Merge pull request #14 from ComiR/3.x
Browse files Browse the repository at this point in the history
!!! TASK: Upgrade for Neos 3.0
  • Loading branch information
hlubek authored Feb 2, 2017
2 parents b62a6ff + 0040318 commit 5ff1360
Show file tree
Hide file tree
Showing 18 changed files with 675 additions and 270 deletions.
64 changes: 64 additions & 0 deletions Classes/BackendFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php
namespace Networkteam\Neos\Shariff;

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

use Heise\Shariff\Backend;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Http\Request;
use Neos\Flow\Http\Uri;

class BackendFactory
{
/**
* @var array
*/
protected static $supportedServices = [
'AddThis',
'Facebook',
'Flattr',
'GooglePlus',
'LinkedIn',
'Pinterest',
'Reddit',
'StumbleUpon',
'Xing',
];

/**
* @Flow\InjectConfiguration(path="options")
* @var array
*/
protected $options;

/**
* @Flow\InjectConfiguration(path="http.baseUri", package="Neos.Flow")
* @var string
*/
protected $baseUri;

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

/**
* @return Backend
*/
public function create()
{
return new Backend($this->options);
}
}
31 changes: 31 additions & 0 deletions Classes/Controller/ShariffController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
namespace Networkteam\Neos\Shariff\Controller;

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

use Heise\Shariff\Backend;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Mvc\Controller\ActionController;

class ShariffController extends ActionController
{
/**
* @var Backend
* @Flow\Inject
*/
protected $shariff;

/**
* @param string $url
*
* @return string
*/
public function countsAction($url = null)
{
$this->response->getHeaders()->set('Content-Type', 'application/json');

return json_encode($this->shariff->get($url));
}
}
53 changes: 0 additions & 53 deletions Classes/Networkteam/Neos/Shariff/BackendFactory.php

This file was deleted.

25 changes: 0 additions & 25 deletions Classes/Networkteam/Neos/Shariff/Controller/ShariffController.php

This file was deleted.

2 changes: 1 addition & 1 deletion Configuration/NodeTypes.Shariff.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'Networkteam.Neos.Shariff:Shariff':
superTypes:
'TYPO3.Neos:Content': true
'Neos.Neos:Content': true
ui:
label: 'Social Plugins'
icon: icon-ellipsis-horizontal
5 changes: 2 additions & 3 deletions Configuration/Policy.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

privilegeTargets:
TYPO3\Flow\Security\Authorization\Privilege\Method\MethodPrivilege:
Neos\Flow\Security\Authorization\Privilege\Method\MethodPrivilege:
Networkteam_Neos_Shariff_Backend:
matcher: method(Networkteam\Neos\Shariff\Controller\ShariffController->countsAction())
roles:
'TYPO3.Flow:Everybody':
'Neos.Flow:Everybody':
privileges:
-
privilegeTarget: Networkteam_Neos_Shariff_Backend
Expand Down
6 changes: 3 additions & 3 deletions Configuration/Routes.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
-
name: 'shariff'
uriPattern: 'counts'
name: 'Networkteam.Neos.Shariff'
uriPattern: 'shariff'
defaults:
'@package': 'Networkteam.Neos.Shariff'
'@controller': 'Shariff'
'@action': 'counts'
'@format': 'json'
appendExceedingArguments: true
appendExceedingArguments: true
31 changes: 22 additions & 9 deletions Configuration/Settings.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
TYPO3:
Neos:
Flow:
mvc:
routes:
'Networkteam.Neos.Shariff':
position: 'before Neos.Neos'
reflection:
ignoredTags:
unstable: TRUE

unstable: true
Neos:
typoScript:
fusion:
autoInclude:
'Networkteam.Neos.Shariff': TRUE
Networkteam.Neos.Shariff: true

Networkteam:
Neos:
Expand All @@ -17,16 +20,26 @@ Networkteam:
orientation: horizontal
language: en
options:
domain: ~
domain: null
cache:
ttl: 3600
services:
# - AddThis
# - Diaspora
# - Facebook
# - Flattr
# - GooglePlus
# - Twitter
# - Info
# - LinkedIn
# - Mail
# - Pinterest
# - Qzone
# - Reddit
# - StumbleUpon
# - Flattr
# - Pinterest
# - tencent-weibo
# - Threema
# - tumblr
# - Twitter
# - weibo
# - Whatsapp
# - Xing
Loading

0 comments on commit 5ff1360

Please sign in to comment.