From 84b9fb43f0548ff5f06f6cdd82e0f5d82c2be4b8 Mon Sep 17 00:00:00 2001
From: Stefan Galinski <stefan@sgalinski.de>
Date: Wed, 20 Jul 2016 18:56:41 +0200
Subject: [PATCH] [FEATURE] No project_base dependencies!

---
 .../Controller/ListByCategoryController.php   |  2 +-
 Classes/Controller/OverviewController.php     |  2 +-
 Classes/Controller/SingleViewController.php   |  2 +-
 Classes/Service/HeaderMetaDataService.php     | 50 +++++++++++++++++++
 4 files changed, 53 insertions(+), 3 deletions(-)
 create mode 100644 Classes/Service/HeaderMetaDataService.php

diff --git a/Classes/Controller/ListByCategoryController.php b/Classes/Controller/ListByCategoryController.php
index d43af36..98f43db 100644
--- a/Classes/Controller/ListByCategoryController.php
+++ b/Classes/Controller/ListByCategoryController.php
@@ -26,7 +26,7 @@ namespace SGalinski\SgNews\Controller;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use SGalinski\ProjectBase\Service\HeaderMetaDataService;
+use SGalinski\SgNews\Service\HeaderMetaDataService;
 use SGalinski\SgNews\Domain\Model\News;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
diff --git a/Classes/Controller/OverviewController.php b/Classes/Controller/OverviewController.php
index 7e65dc4..5dcd3f3 100644
--- a/Classes/Controller/OverviewController.php
+++ b/Classes/Controller/OverviewController.php
@@ -26,7 +26,7 @@ namespace SGalinski\SgNews\Controller;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use SGalinski\ProjectBase\Service\HeaderMetaDataService;
+use SGalinski\SgNews\Service\HeaderMetaDataService;
 use SGalinski\SgNews\Domain\Model\Category;
 use SGalinski\SgNews\Domain\Model\News;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
diff --git a/Classes/Controller/SingleViewController.php b/Classes/Controller/SingleViewController.php
index c0d3c97..1e89a61 100644
--- a/Classes/Controller/SingleViewController.php
+++ b/Classes/Controller/SingleViewController.php
@@ -26,7 +26,7 @@ namespace SGalinski\SgNews\Controller;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use SGalinski\ProjectBase\Service\HeaderMetaDataService;
+use SGalinski\SgNews\Service\HeaderMetaDataService;
 use SGalinski\SgNews\Domain\Model\Category;
 use SGalinski\SgNews\Domain\Model\News;
 use TYPO3\CMS\Core\Page\PageRenderer;
diff --git a/Classes/Service/HeaderMetaDataService.php b/Classes/Service/HeaderMetaDataService.php
new file mode 100644
index 0000000..87ab25e
--- /dev/null
+++ b/Classes/Service/HeaderMetaDataService.php
@@ -0,0 +1,50 @@
+<?php
+
+namespace SGalinski\SgNews\Service;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) sgalinski Internet Services (https://www.sgalinski.de)
+ *
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
+
+/**
+ * Service class for the meta data within the header
+ */
+class HeaderMetaDataService {
+	/**
+	 * Sets the data for the og:image meta data header tag.
+	 *
+	 * @param string $path
+	 * @return void
+	 */
+	public static function addOgImageToHeader($path) {
+		if (strlen($path) <= 0) {
+			return;
+		}
+
+		/** @var $typoScriptController TypoScriptFrontendController */
+		$typoScriptController = $GLOBALS['TSFE'];
+		$typoScriptController->page['og_image_path_by_extension'] = $path;
+	}
+}
-- 
GitLab