Compare commits
12 Commits
Author | SHA1 | Date |
---|---|---|
Marcel Kapfer | cff6ac1849 | |
Marcel Kapfer | 8264969c61 | |
Marcel Kapfer | 89ee94bf28 | |
Marcel Kapfer | 2af99f3a4d | |
Marcel Kapfer | 356360443b | |
Marcel Kapfer | 4c81c9b694 | |
Marcel Kapfer | b704eaae5c | |
Marcel Kapfer | 09f9578d20 | |
Marcel Kapfer | 9c43bfc8f5 | |
Marcel Kapfer | 01c8997c1d | |
Marcel Kapfer | 25ccc28ecc | |
Marcel Kapfer | f5cde24eb6 |
19
CHANGELOG.md
19
CHANGELOG.md
|
@ -1,11 +1,20 @@
|
|||
# 1.1.0
|
||||
# Changelog
|
||||
|
||||
*2021-05-03*
|
||||
## 2.0.0 - 2023-05-06
|
||||
|
||||
- 💥 Drop support for TYPO3 v10 (3563604)
|
||||
- ⬆ Add support for TYPO3 v12 (2af99f3)
|
||||
- ✨🐛 Resolve deprecations introduced with TYPO3 v11 and v12 (89ee94b, 8264969)
|
||||
|
||||
## 1.2.0 - 2022-08-10
|
||||
|
||||
- [FEATURE] Add support for TYPO3 v11 and PHP 8.0 & 8.1 (25ccc28, 9c43bfc)
|
||||
- [TASK] Slight Refactoring (01c8997, 09f9578, b704eaa)
|
||||
|
||||
## 1.1.0 - 2021-05-03
|
||||
|
||||
- [FEATURE] Don't add script if logged into BE (7d22f35)
|
||||
|
||||
# 1.0.0
|
||||
|
||||
*2021-04-12*
|
||||
## 1.0.0 - 2021-04-12
|
||||
|
||||
- [TASK] Initial release
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace MMK2410\PlausibleAnalytics\Hooks;
|
|||
|
||||
use TYPO3\CMS\Core\Page\AssetCollector;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
|
||||
use TYPO3\CMS\Core\Context\Context;
|
||||
|
||||
class PageRendererPreProcess
|
||||
{
|
||||
|
@ -14,32 +14,39 @@ class PageRendererPreProcess
|
|||
/** @var \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController */
|
||||
private $tsfe;
|
||||
|
||||
/** @var Context */
|
||||
private $context;
|
||||
|
||||
public function __construct(AssetCollector $assetCollector = null)
|
||||
{
|
||||
$this->assetCollector = $assetCollector ?? GeneralUtility::makeInstance(AssetCollector::class);
|
||||
$this->tsfe = $GLOBALS['TSFE'];
|
||||
$this->tsfe = $GLOBALS['TSFE'] ?? null;
|
||||
$this->context = GeneralUtility::makeInstance(Context::class);
|
||||
}
|
||||
|
||||
public function addLibrary(): void
|
||||
{
|
||||
if (!isset($this->tsfe)) {
|
||||
if (!isset($this->tsfe)|| !isset($this->context)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$domain = $this->getDomain();
|
||||
$plausible = $this->getPlausibleURL();
|
||||
|
||||
if (isset($domain) && isset($plausible) && !$this->tsfe->isBackendUserLoggedIn()) {
|
||||
GeneralUtility::makeInstance(AssetCollector::class)
|
||||
->addJavaScript(
|
||||
'plausible_analytics',
|
||||
$plausible . '/js/plausible.js',
|
||||
[
|
||||
'async' => 'async',
|
||||
'defer' => 'defer',
|
||||
'data-domain' => $domain
|
||||
],
|
||||
);
|
||||
if (
|
||||
isset($domain) &&
|
||||
isset($plausible) &&
|
||||
!$this->context->getPropertyFromAspect('backend.user', 'isLoggedIn')
|
||||
) {
|
||||
$this->assetCollector->addJavaScript(
|
||||
'plausible_analytics',
|
||||
$plausible . '/js/plausible.js',
|
||||
[
|
||||
'async' => 'async',
|
||||
'defer' => 'defer',
|
||||
'data-domain' => $domain
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"keywords": ["typo3", "plausible", "analytics"],
|
||||
"support": {
|
||||
"email": "opensource@mmk2410.org",
|
||||
"issues": "https://gitlab.com/mmk2410/uulmhack_typo3/-/issues"
|
||||
"issues": "https://gitlab.com/mmk2410/plausible_analytics/-/issues"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@ -22,8 +22,8 @@
|
|||
}
|
||||
},
|
||||
"require": {
|
||||
"php": "7.2.0 - 7.4.99",
|
||||
"typo3/cms-core": "^10.4"
|
||||
"php": "7.4.0 - 8.2.99",
|
||||
"typo3/cms-core": "^11.5 || ^12.4"
|
||||
},
|
||||
"replace": {
|
||||
"typo3-ter/plausible-analytics": "self.version"
|
||||
|
|
|
@ -8,11 +8,11 @@ $EM_CONF[$_EXTKEY] = [
|
|||
'author_email' => 'opensource@mmk2410.org',
|
||||
'state' => 'stable',
|
||||
'clearCacheOnLoad' => true,
|
||||
'version' => '1.1.0',
|
||||
'version' => '2.0.0',
|
||||
'constraints' => [
|
||||
'depends' => [
|
||||
'typo3' => '10.4.0-10.4.99',
|
||||
'php' => '7.2.0-7.4.99'
|
||||
'typo3' => '11.5.0-12.4.99',
|
||||
'php' => '7.4.0-8.2.99'
|
||||
],
|
||||
],
|
||||
'autoload' => [
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
if (!defined('TYPO3_MODE')) {
|
||||
if (!defined('TYPO3')) {
|
||||
die('Access denied.');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue