Skip to content

Commit

Permalink
Merge pull request #48 from Yoast/task/neos-5-compatibility
Browse files Browse the repository at this point in the history
TASK: Neos 5 compatibility and update yoastseo to 1.59.0
  • Loading branch information
Sebobo authored Sep 16, 2019
2 parents 0747d3c + 368f601 commit e219bad
Show file tree
Hide file tree
Showing 59 changed files with 1,222 additions and 1,100 deletions.
7 changes: 4 additions & 3 deletions Classes/Controller/DataController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
declare(strict_types=1);

namespace Yoast\YoastSeoForNeos\Controller;

use Neos\Cache\Frontend\VariableFrontend;
Expand Down Expand Up @@ -55,7 +57,7 @@ class DataController extends ActionController
*
* @Flow\SkipCsrfProtection
*/
public function fetchTranslationsAction()
public function fetchTranslationsAction(): void
{
$interfaceLanguage = $this->userService->getInterfaceLanguage();
$locale = $this->getValidLocale($interfaceLanguage);
Expand All @@ -82,7 +84,6 @@ public function fetchTranslationsAction()
'error' => $error ? $error : 'No translation available for language ' . $interfaceLanguage
]);
}

}

/**
Expand All @@ -91,7 +92,7 @@ public function fetchTranslationsAction()
* @param string $interfaceLanguage
* @return string
*/
protected function getValidLocale($interfaceLanguage)
protected function getValidLocale(string $interfaceLanguage): string
{
if (array_key_exists($interfaceLanguage, $this->languageToLocaleMapping)) {
return $this->languageToLocaleMapping[$interfaceLanguage];
Expand Down
24 changes: 19 additions & 5 deletions Classes/Controller/PageController.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,36 @@
<?php
declare(strict_types=1);

namespace Yoast\YoastSeoForNeos\Controller;

use Neos\ContentRepository\Domain\Model\NodeInterface;
use Neos\Flow\Mvc\Controller\ActionController;
use Neos\Flow\Mvc\Exception\StopActionException;

class PageController extends ActionController
{

/**
/** w
* Redirects request to the given node in preview mode without the neos backend
*
* @param NodeInterface $node
* @throws \Neos\Flow\Mvc\Exception\StopActionException
* @throws StopActionException
*/
public function renderPreviewPageAction(NodeInterface $node)
public function renderPreviewPageAction(NodeInterface $node): void
{
$this->response->getHeaders()->setCacheControlDirective('no-cache');
$this->response->getHeaders()->setCacheControlDirective('no-store');
if (method_exists($this->response, 'setComponentParameter')) {
/** @noinspection PhpUndefinedClassInspection */
/** @noinspection PhpUndefinedNamespaceInspection */
$this->response->setComponentParameter(Neos\Flow\Http\Component\SetHeaderComponent::class, 'Cache-Control', [
'no-cache',
'no-store'
]);
} else {
/** @noinspection PhpUndefinedMethodInspection */
$this->response->getHeaders()->setCacheControlDirective('no-cache');
/** @noinspection PhpUndefinedMethodInspection */
$this->response->getHeaders()->setCacheControlDirective('no-store');
}
$this->redirect('show', 'Frontend\Node', 'Neos.Neos', [
'node' => $node,
'yoastSeoPreviewMode' => true,
Expand Down
20 changes: 13 additions & 7 deletions Classes/FusionObjects/BaseUriImplementation.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
<?php
declare(strict_types=1);

namespace Yoast\YoastSeoForNeos\FusionObjects;

use Neos\Flow\Mvc\Routing\Exception\MissingActionNameException;
use Neos\Flow\Property\Exception as PropertyException;
use Neos\Flow\Security\Exception as SecurityException;
use Neos\Neos\Exception as NeosException;
use Neos\Neos\Fusion\NodeUriImplementation;

/**
* Create a link to a node and trim the format.
* Also enforce a slash at the end.
*/
class BaseUriImplementation extends \Neos\Neos\Fusion\NodeUriImplementation
class BaseUriImplementation extends NodeUriImplementation
{
/**
* If true, shortcuts will be resolved
*
* @return boolean
* @return bool
*/
public function resolveShortcuts()
public function resolveShortcuts(): bool
{
return (boolean)$this->fusionValue('resolveShortcuts');
}
Expand All @@ -24,11 +30,11 @@ public function resolveShortcuts()
*
* @return string The rendered URI or NULL if no URI could be resolved for the given node
* @throws NeosException
* @throws \Neos\Flow\Mvc\Routing\Exception\MissingActionNameException
* @throws \Neos\Flow\Property\Exception
* @throws \Neos\Flow\Security\Exception
* @throws MissingActionNameException
* @throws PropertyException
* @throws SecurityException
*/
public function evaluate()
public function evaluate(): string
{
$baseNode = null;
$baseNodeName = $this->getBaseNodeName() ?: 'documentNode';
Expand Down
4 changes: 3 additions & 1 deletion Classes/FusionObjects/InterfaceLanguageImplementation.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
declare(strict_types=1);

namespace Yoast\YoastSeoForNeos\FusionObjects;

use Neos\Flow\Annotations as Flow;
Expand All @@ -22,7 +24,7 @@ class InterfaceLanguageImplementation extends AbstractFusionObject
*
* @return string
*/
public function evaluate()
public function evaluate(): string
{
return $this->userService->getInterfaceLanguage();
}
Expand Down
4 changes: 2 additions & 2 deletions Resources/Private/Fusion/Override/LangAttribute.fusion
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
prototype(Neos.Seo:LangAttribute) {
# Always render lang attribute to be able to use it for the analyzer
value.@process.addFallback = ${value ? value : Configuration.setting('Yoast.YoastSeoForNeos.defaultContentLocale')}
@if.languageDimensionExists >
@if.onlyRenderWhenInLiveWorkspace >
@if.languageDimensionExists = true
@if.onlyRenderWhenInLiveWorkspace = true
}
2 changes: 1 addition & 1 deletion Resources/Private/Languages/bg_BG.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/bs_BA.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/ca.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/cs_CZ.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/da_DK.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/de_CH-informal.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/de_DE-formal.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/de_DE.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/el.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/en_AU.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/en_CA.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/en_GB.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/en_NZ.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/en_ZA.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/es_AR.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/es_ES.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/es_MX.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/es_PE.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/es_VE.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/fa_IR.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/fr_CA.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/fr_FR.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/gl_ES.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/he_IL.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/hr.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/hu_HU.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/it_IT.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/ja.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/nb_NO.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/nl_BE.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/nl_NL-formal.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/nl_NL.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/pl_PL.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/pt_AO.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/pt_BR.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion Resources/Private/Languages/pt_PT-ao90.json

This file was deleted.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/pt_PT.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/ro_RO.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/ru_RU.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/sk_SK.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/sr_RS.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/sv_SE.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/tr_TR.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/uk.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/vi.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/zh_CN.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Private/Languages/zh_TW.json

Large diffs are not rendered by default.

Loading

0 comments on commit e219bad

Please sign in to comment.