Skip to content

Commit

Permalink
Merge pull request #4 from clickstorm/TYPO3-10
Browse files Browse the repository at this point in the history
Add support for TYPO3 10.4
  • Loading branch information
akoenig-clickstorm authored Sep 30, 2021
2 parents 2c66fb6 + c3894cf commit e5941f3
Show file tree
Hide file tree
Showing 14 changed files with 105 additions and 162 deletions.
33 changes: 18 additions & 15 deletions Classes/Controller/YoutubeDataController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,26 @@
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Utility\ArrayUtility;

use TYPO3\CMS\Core\Messaging\AbstractMessage;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;

/**
* YoutubeDataController
*/
class YoutubeDataController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
class YoutubeDataController extends ActionController
{

private $extConf;

/**
* action initialize
*
* @return void
*/
public function initializeAction() {
$this->extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['cs_youtube_data']);
$this->extConf = $GLOBALS["TYPO3_CONF_VARS"]["EXTENSIONS"]["cs_youtube_data"];
}

/**
Expand Down Expand Up @@ -94,26 +100,26 @@ public function listAction() {
if(!empty($data->error)){
//Errorcode API
$errorCode = $data->error->code;
$errorCodeLanguage = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_csyoutubedata_error_code', 'cs_youtube_data');
$errorCodeLanguage = LocalizationUtility::translate('tx_csyoutubedata_error_code', 'cs_youtube_data');

//Errormessage API
$errorMessage = $data->error->message;
$errorMessageLanguage = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_csyoutubedata_error_message', 'cs_youtube_data');
$errorMessageLanguage = LocalizationUtility::translate('tx_csyoutubedata_error_message', 'cs_youtube_data');

//Reason API
$reason = $data->error->errors[0]->reason;
$errorReasonLanguage = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_csyoutubedata_error_reason', 'cs_youtube_data');
$errorReasonLanguage = LocalizationUtility::translate('tx_csyoutubedata_error_reason', 'cs_youtube_data');

//Error Link
$errorLink = 'https://developers.google.com/youtube/v3/docs/errors';

$messageTitle = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_csyoutubedata_error', 'cs_youtube_data');
$messageTitle = LocalizationUtility::translate('tx_csyoutubedata_error', 'cs_youtube_data');
$messageBody = $errorCodeLanguage.$errorCode.' | '.$errorMessageLanguage.$errorMessage.' | '.$errorReasonLanguage.$reason.' | '.$errorLink;

$this->addFlashMessage(
$messageBody,
$messageTitle,
\TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR
AbstractMessage::ERROR
);
}elseif(!empty($data->items)){
$items = array();
Expand All @@ -137,16 +143,13 @@ public function listAction() {
$this->view->assign('videos', $videos['items']);
}
}else{
$messageTitle = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_csyoutubedata_channel_false_check', 'cs_youtube_data');
$messageBody = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_csyoutubedata_channel_false', 'cs_youtube_data').' - '.$channelId.'!';
$messageTitle = LocalizationUtility::translate('tx_csyoutubedata_channel_false_check', 'cs_youtube_data');
$messageBody = LocalizationUtility::translate('tx_csyoutubedata_channel_false', 'cs_youtube_data').' - '.$channelId.'!';
$this->addFlashMessage(
$messageBody,
$messageTitle,
\TYPO3\CMS\Core\Messaging\AbstractMessage::WARNING
AbstractMessage::WARNING
);
}
}



}
}
15 changes: 12 additions & 3 deletions Classes/ViewHelpers/ConvertDurationViewHelper.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
<?php
namespace Clickstorm\CsYoutubeData\ViewHelpers;

use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;

/**
* Created by PhpStorm.
* User: akirilow
* Date: 02.04.2015
* Time: 09:13
*/
class ConvertDurationViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {
class ConvertDurationViewHelper extends AbstractViewHelper {

public function initializeArguments()
{
$this->registerArgument('duration', 'int', 'The duration with which Youtube Video gets converted', true);
}

/**
*Converts the duration of Youtube Video
Expand All @@ -15,7 +23,8 @@ class ConvertDurationViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\Abstrac
* @return string string
* @author Andreas Kirilow <[email protected]>
*/
public function render($duration) {
public function render() {
$duration = $this->arguments['duration'];
preg_match('#PT(.*?)H(.*?)M(.*?)S#si',$duration,$out);
if(empty($out[1])){
preg_match('#PT(.*?)M(.*?)S#si',$duration,$out);
Expand All @@ -40,4 +49,4 @@ public function render($duration) {
}
}
}
?>
?>
3 changes: 2 additions & 1 deletion Configuration/FlexForms/flexform_pi1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
</label>
<config>
<type>select</type>
<renderType>selectSingle</renderType>
<items>
<numIndex index="0" type="array">
<numIndex index="0">LLL:EXT:cs_youtube_data/Resources/Private/Language/locallang.xlf:tx_csyoutubedata_flexform_settings.order.date</numIndex>
Expand Down Expand Up @@ -62,4 +63,4 @@
</sDEF>
</sheets>

</T3DataStructure>
</T3DataStructure>
8 changes: 8 additions & 0 deletions Configuration/Services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
_defaults:
autowire: true
autoconfigure: true
public: false

Clickstorm\CsYoutubeData\:
resource: '../Classes/*'
11 changes: 11 additions & 0 deletions Configuration/TCA/Overrides/sys_template.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

defined('TYPO3_MODE') or die();

/* Default TS */
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
'cs_youtube_data',
'Configuration/TypoScript',
'Youtube Data'
);

19 changes: 19 additions & 0 deletions Configuration/TCA/Overrides/tt_content.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

defined('TYPO3_MODE') or die();

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'Clickstorm.' . 'cs_youtube_data',
'Pi1',
'Youtube Data V3 Plugin'
);

//FlexForm add
$pluginSignature = str_replace('_', '', 'cs_youtube_data') . '_pi1';
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature]='code,layout,select_key,pages,recursive';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
$pluginSignature,
'FILE:EXT:cs_youtube_data/Configuration/FlexForms/flexform_pi1.xml'
);

77 changes: 0 additions & 77 deletions Configuration/TypoScript/setup.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,83 +19,6 @@ plugin.tx_csyoutubedata {
videoPlayerWidth = {$plugin.tx_csyoutubedata.settings.videoPlayerWidth}
videoPlayerHeight = {$plugin.tx_csyoutubedata.settings.videoPlayerHeight}
}
_CSS_DEFAULT_STYLE (
#typo3-messages {
margin-bottom: 10px;
font-family: arial, sans-serif; }

.typo3-message {
margin-bottom: 4px;
padding: 12px;
padding-left: 36px; }

.typo3-message ul, .typo3-message ol {
padding-left: 16px; }

.typo3-message .message-header {
display: block; }

.typo3-message {
border: 1px solid;
background-position: 10px 12px;
background-repeat: no-repeat; }

.typo3-message a {
text-decoration: underline; }

.typo3-message li {
margin-bottom: 10px;
list-style: disc; }

.typo3-message .message-header {
font-size: 11px;
font-weight: bold; }

.message-notice {
color: #777;
background-color: #f6f7fa;
background-image: url("/typo3/sysext/t3skin/icons/gfx/notice.png");
border-color: #c2cbcf; }

.message-notice a {
color: #777; }

.message-information {
color: #4c73a1;
background-color: #eaf7ff;
background-image: url("/typo3/sysext/t3skin/icons/gfx/information.png");
border-color: #c5dbe6; }

.message-information a {
color: #4c73a1; }

.message-ok {
color: #3b7826;
background-color: #cdeaca;
background-image: url("/typo3/sysext/t3skin/icons/gfx/ok.png");
border-color: #58b548; }

.message-ok a {
color: #3b7826; }

.message-warning {
color: #9e7d4a;
background-color: #fbf6de;
background-image: url("/typo3/sysext/t3skin/icons/gfx/warning.png");
border-color: #b1905c; }

.message-warning a {
color: #9e7d4a; }

.message-error {
color: #aa0225;
background-color: #f6d3cf;
background-image: url("/typo3/sysext/t3skin/icons/gfx/error.png");
border-color: #d66c68; }

.message-error a {
color: #aa0225; }
)
}

page.includeCSS.tx_csyoutubedata = https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css
14 changes: 6 additions & 8 deletions Resources/Private/Partials/Video.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
{namespace cs=Clickstorm\CsYoutubeData\ViewHelpers}
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
<head>
<title>Partials: Video</title>
</head>
<body>
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:cs="http://typo3.org/ns/Clickstorm/CsYoutubeData/ViewHelpers"
data-namespace-typo3-fluid="true">

<f:section name="Main">
<table class="table table-striped table-bordered">
<tr>
Expand Down Expand Up @@ -59,4 +56,5 @@
</table>
<br />
</f:section>
</body>

</html>
10 changes: 6 additions & 4 deletions Resources/Private/Templates/YoutubeData/List.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<f:layout name="Default" />
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
data-namespace-typo3-fluid="true">

<div xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
<f:layout name="Default" />

<f:section name="Main">
<f:flashMessages />
Expand All @@ -14,4 +15,5 @@ <h1><f:link.external uri="https://www.youtube.com/channel/{settings.channelId}"
</f:for>
</f:if>
</f:section>
</div>

</html>
File renamed without changes
16 changes: 9 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
{
"name": "clickstorm/cs_youtube_data",
"name": "clickstorm/cs-youtube-data",
"type": "typo3-cms-extension",
"description": "[clickstorm] Youtube Data V3",
"homepage": "https://www.clickstorm.de",
"license": [
"GPL-2.0+"
],
"license": [ "GPL-2.0-or-later" ],
"keywords": [
"typo3",
"clickstorm",
"YouTube"
],
"version": "2.0.0",
"replace": {
"cs_youtube_data": "*"
"typo3-ter/cs_youtube_data": "self.version"
},
"require": {
"typo3/cms": ">=8.7.0"
"typo3/cms-core": "^10.4"
},
"extra": {
"typo3/cms": {
"extension-key": "cs_youtube_data"
}
},
"autoload": {
"psr-4": {
Expand Down
25 changes: 9 additions & 16 deletions ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,19 @@
* "version" and "dependencies" must not be touched!
***************************************************************/

$EM_CONF[$_EXTKEY] = array(
$EM_CONF[$_EXTKEY] = [
'title' => '[clickstorm] Youtube Data V3',
'description' => 'Displays a youtube channel on your page',
'category' => 'plugin',
'author' => 'Andreas Kirilow - clickstorm GmbH',
'author_email' => '[email protected]',
'author_company' => 'clickstorm GmbH',
'state' => 'stable',
'internal' => '',
'uploadfolder' => '0',
'createDirs' => '',
'clearCacheOnLoad' => 0,
'version' => '2.0.1',
'constraints' => array(
'depends' => array(
'typo3' => '8.7.0 - 8.7.99',
),
'conflicts' => array(
),
'suggests' => array(
),
),
);
'clearCacheOnLoad' => 1,
'version' => '3.0.0',
'constraints' => [
'depends' => [
'typo3' => '10.4.0-10.4.99',
]
],
];
Loading

1 comment on commit e5941f3

@NamelessCoder
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Error code: 0 - Username does not exist or password is wrong.

  • NamelessCoder\GizzleGitPlugins\GizzlePlugins\ClonePlugin:000000005b916e390000000013348bbb:

Please sign in to comment.