Skip to content

Commit

Permalink
Merge pull request #25 from christian-fries/master
Browse files Browse the repository at this point in the history
Support for TYPO3 10.4
  • Loading branch information
Zillion01 committed Sep 2, 2020
2 parents 0458cbc + 7bcdcf8 commit 1cb7fc5
Show file tree
Hide file tree
Showing 21 changed files with 52 additions and 182 deletions.
3 changes: 2 additions & 1 deletion Classes/Controller/CategorycommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

use Jp\Jpfaq\Service\SendMailService;
use Jp\Jpfaq\Domain\Model\Categorycomment;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
Expand Down Expand Up @@ -104,7 +105,7 @@ public function addCommentAction(Categorycomment $newCategorycomment, array $cat

if ($currentUid == $pluginUid) {
// Set comment IP
$extensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['jpfaq']);
$extensionConfiguration = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('jpfaq');
$anonymizeIpSetting = $extensionConfiguration['anonymizeIp'];
$commentIp= (string)GeneralUtility::getIndpEnv('REMOTE_ADDR');

Expand Down
3 changes: 2 additions & 1 deletion Classes/Controller/QuestioncommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Jp\Jpfaq\Service\SendMailService;
use Jp\Jpfaq\Domain\Model\Question;
use Jp\Jpfaq\Domain\Model\Questioncomment;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
Expand Down Expand Up @@ -85,7 +86,7 @@ public function addCommentAction(Question $question, Questioncomment $newQuestio

if ($currentUid == $pluginUid) {
// Set comment IP
$extensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['jpfaq']);
$extensionConfiguration = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('jpfaq');
$anonymizeIpSetting = $extensionConfiguration['anonymizeIp'];
$commentIp= (string)GeneralUtility::getIndpEnv('REMOTE_ADDR');

Expand Down
10 changes: 10 additions & 0 deletions Classes/Domain/Model/Question.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,16 @@ public function setNothelpful($nothelpful)
$this->nothelpful = $nothelpful;
}

/**
* Returns the Questioncomment
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Jp\Jpfaq\Domain\Model\Questioncomment>
*/
public function getQuestioncomment()
{
return $this->questioncomment;
}

/**
* Adds a questioncomment
*
Expand Down
33 changes: 0 additions & 33 deletions Classes/Domain/Model/TtContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,6 @@
*/
class TtContent extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* uid
*
* @var string
*/
protected $uid = '';

/**
* pid
*
* @var string
*/
protected $pid = '';

/**
* @var \DateTime
*/
Expand Down Expand Up @@ -617,23 +603,4 @@ public function getContentType() {
public function setContentType($contentType) {
$this->contentType = $contentType;
}

/**
* Gets the uid
*
* @return string $uid
*/
public function getUid() {
return $this->uid;
}

/**
* Gets the pid
*
* @return string $pid
*/
public function getPid() {
return $this->pid;
}

}
9 changes: 8 additions & 1 deletion Classes/Service/SendMailService.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ public static function sendMail(string $receivers, array $sender, string $subjec
$mail->setTo($receivers);
$mail->setFrom($sender);
$mail->setSubject($subject);
$mail->setBody('<html><head></head><body>' . $body . ' </body></html>', 'text/html');

// TYPO3 10 uses Mailer whereas TYPO3 9 uses SwiftMailer
if (method_exists($mail, 'html')) {
$mail->html('<html><head></head><body>' . $body . ' </body></html>');
} else {
$mail->setBody('<html><head></head><body>' . $body . ' </body></html>', 'text/html');
}

$mail->send();

return $mail->isSent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
* LICENSE file that was distributed with this source code.
*/
use Jp\Jpfaq\Domain\Model\Question;
use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3\CMS\Fluid\Core\ViewHelper\Facets\CompilableInterface;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;

/**
Expand All @@ -28,7 +27,7 @@
* </output>
*
*/
class ExcludeAlreadyDisplayedQuestionsViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper implements CompilableInterface
class ExcludeAlreadyDisplayedQuestionsViewHelper extends \TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper
{
use CompileWithRenderStatic;

Expand Down
13 changes: 13 additions & 0 deletions Configuration/Extbase/Persistence/Classes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
declare(strict_types = 1);

return [
\Jp\Jpfaq\Domain\Model\TtContent::class => [
'tableName' => 'tt_content',
'properties' => [
'contentType' => [
'fieldName' => 'CType'
],
],
],
];
1 change: 0 additions & 1 deletion Configuration/TCA/tx_jpfaq_domain_model_category.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'dividers2tabs' => 1,
'sortby' => 'sorting',
'versioningWS' => true,
'languageField' => 'sys_language_uid',
Expand Down
1 change: 0 additions & 1 deletion Configuration/TCA/tx_jpfaq_domain_model_question.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'dividers2tabs' => 1,
'sortby' => 'sorting',
'versioningWS' => true,
'languageField' => 'sys_language_uid',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'sortby' => 'sorting',
'default_sortby' => 'crdate DESC',
'versioningWS' => true,
'languageField' => 'sys_language_uid',
Expand Down
1 change: 1 addition & 0 deletions Configuration/TsConfig/includePageTSconfig.tsconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<INCLUDE_TYPOSCRIPT: source="DIR: EXT:jpfaq/Configuration/TsConfig/Page/" extension="tsconfig">
1 change: 0 additions & 1 deletion Configuration/TypoScript/TSconfig/includePageTSconfig.ts

This file was deleted.

File renamed without changes.
File renamed without changes.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# jpfaq
Frequently Asked Questions (FAQ) plugin. Optional features: categories, on-the-fly search, customer helpfulness tracking and comments.

For TYPO3 9.5
For TYPO3 9.5 and TYPO3 10.4

Install: composer require jvdp/jpfaq
## Install

To install this extension, run `composer require jvdp/jpfaq`.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"issues": "https://forge.typo3.org/projects/extension-jpfaq/"
},
"require": {
"typo3/cms-core": "^9.5"
"typo3/cms-core": "^9.5 || ^10.4"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
array(
'depends' =>
array(
'typo3' => '9.5.0-9.5.99',
'typo3' => '9.5.0-10.4.99',
),
'conflicts' =>
array(),
Expand Down
4 changes: 2 additions & 2 deletions ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ function ($extKey) {
]
);
},
$_EXTKEY
'jpfaq'
);

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE: EXT:jpfaq/Configuration/TypoScript/TSconfig/includePageTSconfig.ts">');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE: EXT:jpfaq/Configuration/TsConfig/includePageTSconfig.tsconfig">');

/**
* Icon registry
Expand Down
Loading

0 comments on commit 1cb7fc5

Please sign in to comment.