Compare commits
4 commits
f5cde24eb6
...
09f9578d20
Author | SHA1 | Date | |
---|---|---|---|
09f9578d20 | |||
9c43bfc8f5 | |||
01c8997c1d | |||
25ccc28ecc |
3 changed files with 14 additions and 16 deletions
|
@ -4,7 +4,6 @@ namespace MMK2410\PlausibleAnalytics\Hooks;
|
|||
|
||||
use TYPO3\CMS\Core\Page\AssetCollector;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
|
||||
|
||||
class PageRendererPreProcess
|
||||
{
|
||||
|
@ -17,7 +16,7 @@ class PageRendererPreProcess
|
|||
public function __construct(AssetCollector $assetCollector = null)
|
||||
{
|
||||
$this->assetCollector = $assetCollector ?? GeneralUtility::makeInstance(AssetCollector::class);
|
||||
$this->tsfe = $GLOBALS['TSFE'];
|
||||
$this->tsfe = $GLOBALS['TSFE'] ?? null;
|
||||
}
|
||||
|
||||
public function addLibrary(): void
|
||||
|
@ -30,16 +29,15 @@ class PageRendererPreProcess
|
|||
$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
|
||||
],
|
||||
);
|
||||
$this->assetCollector->addJavaScript(
|
||||
'plausible_analytics',
|
||||
$plausible . '/js/plausible.js',
|
||||
[
|
||||
'async' => 'async',
|
||||
'defer' => 'defer',
|
||||
'data-domain' => $domain
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
}
|
||||
},
|
||||
"require": {
|
||||
"php": "7.2.0 - 7.4.99",
|
||||
"typo3/cms-core": "^10.4"
|
||||
"php": "7.2.0 - 8.1.99",
|
||||
"typo3/cms-core": "^10.4 || ^11.5"
|
||||
},
|
||||
"replace": {
|
||||
"typo3-ter/plausible-analytics": "self.version"
|
||||
|
|
|
@ -11,8 +11,8 @@ $EM_CONF[$_EXTKEY] = [
|
|||
'version' => '1.1.0',
|
||||
'constraints' => [
|
||||
'depends' => [
|
||||
'typo3' => '10.4.0-10.4.99',
|
||||
'php' => '7.2.0-7.4.99'
|
||||
'typo3' => '10.4.0-11.5.99',
|
||||
'php' => '7.2.0-8.1.99'
|
||||
],
|
||||
],
|
||||
'autoload' => [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue