IsCustomDomainViewHelper.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace Opentalent\OtTemplating\ViewHelpers\Request;
  3. use Closure;
  4. use Opentalent\OtCore\ViewHelpers\OtAbstractViewHelper;
  5. use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
  6. /**
  7. * Return true if the requested website's domain is a custom domain,
  8. * i.e. its domain is not of the form *.opentalent.fr
  9. *
  10. * {namespace ot=Opentalent\OtTemplating\ViewHelpers}
  11. *
  12. * {ot:request.isCustomDomain()}
  13. *
  14. * @package Opentalent\OtTemplating\ViewHelpers
  15. */
  16. class IsCustomDomainViewHelper extends OtAbstractViewHelper {
  17. /**
  18. * -- This method is expected by Fluid --
  19. * Declares the viewhelper's parameters
  20. */
  21. public function initializeArguments()
  22. {
  23. }
  24. /**
  25. * -- This method is expected by Fluid --
  26. * Renders the content as html
  27. *
  28. * @param array $arguments
  29. * @param Closure $renderChildrenClosure
  30. * @param RenderingContextInterface $renderingContext
  31. * @return string|null
  32. */
  33. public static function renderStatic(
  34. array $arguments,
  35. Closure $renderChildrenClosure,
  36. RenderingContextInterface $renderingContext
  37. ) {
  38. return !preg_match(
  39. "/.*\.opentalent\.fr/",
  40. $_SERVER['HTTP_HOST']
  41. );
  42. }
  43. }