Skip to content

Commit

Permalink
[TASK] Make it more work on 9.5
Browse files Browse the repository at this point in the history
  • Loading branch information
georgringer committed Sep 9, 2019
1 parent 007c595 commit 63bf4f6
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 117 deletions.
33 changes: 27 additions & 6 deletions Classes/Controller/ModFuncController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,23 @@

use GeorgRinger\PageSpeed\Domain\Model\Dto\Configuration;
use GeorgRinger\PageSpeed\Domain\Repository\PageSpeedRepository;
use TYPO3\CMS\Backend\Module\AbstractFunctionModule;
use TYPO3\CMS\Backend\Module\BaseScriptClass;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\View\StandaloneView;

class ModFuncController extends AbstractFunctionModule
class ModFuncController
{
/**
* Contains a reference to the parent (calling) object (which is probably an instance of
* an extension class to \TYPO3\CMS\Backend\Module\BaseScriptClass
*
* @var BaseScriptClass
* @see init()
*/
public $pObj;

/** @var StandaloneView */
protected $view;
Expand All @@ -30,6 +37,20 @@ class ModFuncController extends AbstractFunctionModule
/** @var int */
protected $pageId = 0;


/**
* Initialize the object
*
* @param \object $pObj A reference to the parent (calling) object
* @throws \RuntimeException
* @see \TYPO3\CMS\Backend\Module\BaseScriptClass::checkExtObj()
*/
public function init($pObj)
{
$this->pObj = $pObj;
$this->pObj->MOD_MENU = array_merge($this->pObj->MOD_MENU, $this->modMenu());
}

public function __construct()
{
$this->view = GeneralUtility::makeInstance(StandaloneView::class);
Expand Down Expand Up @@ -141,13 +162,13 @@ protected function checkPageId(): void
*/
protected function addScripts()
{
$path = ExtensionManagementUtility::siteRelPath('page_speed') . 'Resources/Public/';
$this->getDocumentTemplate()->addStyleSheet('page_speed', '../' . $path . 'Styles/speed.css');
$pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
$pageRenderer->addCssFile('EXT:page_speed/Resources/Public/Styles/speed.css');

$jsFiles = ['JavaScript/main.js', 'Contrib/amcharts/amcharts.js', 'Contrib/amcharts/gauge.js', 'Contrib/amcharts/serial.js', 'Contrib/amcharts/themes/dark.js'];
$pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
foreach ($jsFiles as $file) {
$pageRenderer->addJsFile('../' . $path . $file);
$pageRenderer->addJsFile('EXT:page_speed/Resources/Public/' . $file);
}
}

Expand Down
15 changes: 10 additions & 5 deletions Classes/Domain/Model/Dto/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

namespace GeorgRinger\PageSpeed\Domain\Model\Dto;

use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Exception;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;

class Configuration implements SingletonInterface
{
Expand All @@ -18,12 +21,14 @@ class Configuration implements SingletonInterface

public function __construct()
{
$configuration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['page_speed']);
if (\is_array($configuration)) {
$this->key = (string)$configuration['key'];
$this->demo = (bool)$configuration['demo'];
$this->cacheTime = (int)$configuration['cacheTime'];
try {
$configuration = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('page_speed');
} catch (\Exception $e) {
$configuration = [];
}
$this->key = (string)$configuration['key'];
$this->demo = (bool)$configuration['demo'];
$this->cacheTime = (int)$configuration['cacheTime'];
}

/**
Expand Down
95 changes: 0 additions & 95 deletions Classes/Service/UrlService.php

This file was deleted.

2 changes: 1 addition & 1 deletion Classes/ViewHelpers/Chart/AssetsViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

use GeorgRinger\PageSpeed\Domain\Model\Response;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;

class AssetsViewHelper extends AbstractViewHelper
{
Expand Down
2 changes: 1 addition & 1 deletion Classes/ViewHelpers/Chart/GaugeViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

use GeorgRinger\PageSpeed\Domain\Model\Response;
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;

class GaugeViewHelper extends AbstractViewHelper
{
Expand Down
2 changes: 1 addition & 1 deletion Classes/ViewHelpers/IndicatorRulesViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace GeorgRinger\PageSpeed\ViewHelpers;

use GeorgRinger\PageSpeed\Domain\Model\Response;
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;

class IndicatorRulesViewHelper extends AbstractViewHelper
{
Expand Down
2 changes: 1 addition & 1 deletion Classes/ViewHelpers/IndicatorViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace GeorgRinger\PageSpeed\ViewHelpers;

use GeorgRinger\PageSpeed\Domain\Model\Response;
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;

class IndicatorViewHelper extends AbstractViewHelper
{
Expand Down
4 changes: 2 additions & 2 deletions Classes/ViewHelpers/ResultViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace GeorgRinger\PageSpeed\ViewHelpers;

use GeorgRinger\PageSpeed\Domain\Model\Response\Result;
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;

class ResultViewHelper extends AbstractViewHelper
{
Expand All @@ -26,7 +26,7 @@ public function render()
$result = $this->arguments['result'];
$hsc = $this->arguments['hsc'];

if (is_null($result)) {
if ($result === null) {
return '';
}
$searchReplace = [];
Expand Down
2 changes: 1 addition & 1 deletion Classes/ViewHelpers/UrlBlockViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace GeorgRinger\PageSpeed\ViewHelpers;

use GeorgRinger\PageSpeed\Domain\Model\Response\Result;
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;

class UrlBlockViewHelper extends AbstractViewHelper
{
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"GPL-2.0+"
],
"require": {
"typo3/cms-core": "^9.4"
"typo3/cms-core": "^9.5"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 2 additions & 2 deletions ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
'author_email' => '[email protected]',
'state' => 'beta',
'clearCacheOnLoad' => true,
'version' => '3.0.0',
'version' => '3.1.0',
'constraints' => [
'depends' => [
'typo3' => '9.4.0-9.9.99',
'typo3' => '9.5.0-9.9.99',
],
'conflicts' => [],
'suggests' => [],
Expand Down
2 changes: 1 addition & 1 deletion ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
$configuration = new \GeorgRinger\PageSpeed\Domain\Model\Dto\Configuration();

$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['page_speed_response'] = [
'frontend' => \TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class,
'frontend' => \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class,
'backend' => \TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend::class,
'options' => [
'defaultLifetime' => $configuration->getCacheTime(),
Expand Down

0 comments on commit 63bf4f6

Please sign in to comment.