Skip to content

Commit

Permalink
Merge branch 'development' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
NamelessCoder committed Jul 28, 2016
2 parents 9e6e313 + cdbc6aa commit f9e9ab5
Show file tree
Hide file tree
Showing 10 changed files with 1,218 additions and 30,341 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# VHS Change log

3.0.1 - 2016-07-29
------------------

- [#1067](https://github.com/FluidTYPO3/vhs/pull/1067) Argument `subject` on `v:format.preg.replace` made optional to allow usage with tag content / inline
- [#1068](https://github.com/FluidTYPO3/vhs/pull/1068) Page-related ViewHelpers operable in backend context
- [#1073](https://github.com/FluidTYPO3/vhs/pull/1073) Bug fix to show sub menus with single item on root level pages
- [#1074](https://github.com/FluidTYPO3/vhs/pull/1074) Bug fix to remove unintentionally shown pages from menus
- [#1077](https://github.com/FluidTYPO3/vhs/pull/1077) Added `JSON_HEX_APOS` to default JSON encoding parameters in `v:format.json.encode`


3.0.0 - 2016-07-12
------------------

Expand Down
21 changes: 20 additions & 1 deletion Classes/Service/PageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ class PageService implements SingletonInterface
*/
protected static $cachedRootlines = [];

/**
* @var PageRepository
*/
protected static $backendPageRepository;

/**
* @param integer $pageUid
* @param array $excludePages
Expand Down Expand Up @@ -172,7 +177,7 @@ public function hidePageForLanguageUid($page = null, $languageUid = -1, $normalW
$hideIfDefaultLanguage = (boolean) GeneralUtility::hideIfDefaultLanguage($l18nCfg);
$pageOverlay = [];
if (0 !== $languageUid) {
$pageOverlay¨ = $GLOBALS['TSFE']->sys_page->getPageOverlay($pageUid, $languageUid);
$pageOverlay = $GLOBALS['TSFE']->sys_page->getPageOverlay($pageUid, $languageUid);
}
$translationAvailable = (0 !== count($pageOverlay));

Expand All @@ -187,9 +192,23 @@ public function hidePageForLanguageUid($page = null, $languageUid = -1, $normalW
*/
protected function getPageRepository()
{
if (TYPO3_MODE === 'BE') {
return $this->getPageRepositoryForBackendContext();
}
return clone $GLOBALS['TSFE']->sys_page;
}

/**
* @return PageRepository
*/
protected function getPageRepositoryForBackendContext()
{
if (static::$backendPageRepository === null) {
static::$backendPageRepository = GeneralUtility::makeInstance(PageRepository::class);
}
return static::$backendPageRepository;
}

/**
* @param array $page
* @param boolean $forceAbsoluteUrl
Expand Down
1 change: 0 additions & 1 deletion Classes/ViewHelpers/Content/InfoViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,5 @@ public function render()
}

return $this->renderChildrenWithVariableOrReturnInput($content);

}
}
2 changes: 1 addition & 1 deletion Classes/ViewHelpers/Format/Json/EncodeViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ protected function encodeValue($value, $useTraversableKeys, $preventRecursion, $
$value = $this->recursiveArrayOfDomainObjectsToArray($value, $preventRecursion, $recursionMarker);
$value = $this->recursiveDateTimeToUnixtimeMiliseconds($value, $dateTimeFormat);
};
$json = json_encode($value, JSON_HEX_AMP | JSON_HEX_QUOT | JSON_HEX_TAG);
$json = json_encode($value, JSON_HEX_AMP | JSON_HEX_QUOT | JSON_HEX_APOS | JSON_HEX_TAG);
if (JSON_ERROR_NONE !== json_last_error()) {
throw new Exception('The provided argument cannot be converted into JSON.', 1358440181);
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/ViewHelpers/Format/PregReplaceViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function initializeArguments()
{
$this->registerAsArgument();
$this->registerArgument('pattern', 'string', 'Regex pattern to match against', true);
$this->registerArgument('subject', 'string', 'String to match with the regex pattern or patterns', true);
$this->registerArgument('subject', 'string', 'String to match with the regex pattern or patterns');
$this->registerArgument('replacement', 'string', 'String to replace matches with', true);
}

Expand Down
1 change: 0 additions & 1 deletion Classes/ViewHelpers/Format/SanitizeStringViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,5 @@ public static function renderStatic(
$pattern = '/([^a-z0-9\-]){1,}/';
$string = preg_replace($pattern, '-', $string);
return trim($string, '-');

}
}
18 changes: 11 additions & 7 deletions Classes/ViewHelpers/Menu/AbstractMenuViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -381,14 +381,14 @@ protected function renderItemLink(array $page)
/**
* @param null|integer $pageUid
* @param integer $entryLevel
* @return integer
* @return null|integer
*/
protected function determinePageUid($pageUid = null, $entryLevel = 0)
protected function determineParentPageUid($pageUid = null, $entryLevel = 0)
{
$rootLineData = $this->pageService->getRootLine();
if (null === $pageUid) {
if (null !== $entryLevel) {
if (0 > $entryLevel) {
if ($entryLevel < 0) {
$entryLevel = count($rootLineData) - 1 + $entryLevel;
}
$pageUid = $rootLineData[$entryLevel]['uid'];
Expand All @@ -397,18 +397,20 @@ protected function determinePageUid($pageUid = null, $entryLevel = 0)
}
}

return (integer) $pageUid;
return $pageUid;
}

/**
* @param null|integer $pageUid
* @param integer $entryLevel
*
* @return array
*/
public function getMenu($pageUid = null, $entryLevel = 0)
{
$pageUid = $this->determinePageUid($pageUid, $entryLevel);
$pageUid = $this->determineParentPageUid($pageUid, $entryLevel);
if ($pageUid === null) {
return [];
}
$showHiddenInMenu = (boolean) $this->arguments['showHiddenInMenu'];
$showAccessProtected = (boolean) $this->arguments['showAccessProtected'];
$includeSpacers = (boolean) $this->arguments['includeSpacers'];
Expand All @@ -432,6 +434,7 @@ public function parseMenu(array $pages)
$count = 0;
$total = count($pages);
$allowedDocumentTypes = $this->allowedDoktypeList();
$processedPages = [];
foreach ($pages as $index => $page) {
if (!in_array($page['doktype'], $allowedDocumentTypes)) {
continue;
Expand Down Expand Up @@ -487,9 +490,10 @@ public function parseMenu(array $pages)
$pages[$index]['linktext'] = $this->getItemTitle($pages[$index]);
$forceAbsoluteUrl = $this->arguments['forceAbsoluteUrl'];
$pages[$index]['link'] = $this->pageService->getItemLink($page, $forceAbsoluteUrl);
$processedPages[$index] = $pages[$index];
}

return $pages;
return $processedPages;
}

/**
Expand Down
Loading

0 comments on commit f9e9ab5

Please sign in to comment.