diff --git a/.gitignore b/.gitignore index 671c7ff..7cf426f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ manifest/tmp/ symphony/ workspace/uploads/ install-log.txt +.vscode/ diff --git a/composer.json b/composer.json index 1b722cd..b4862b3 100644 --- a/composer.json +++ b/composer.json @@ -9,14 +9,13 @@ ], "type": "contao-bundle", "license": "LGPL-3.0-or-later", - "authors": [ - { + "authors": [{ "name": "Markus Nestmann", "role": "Developer" }, { - "name":"postyou", - "homepage":"http://postyou.de" + "name": "postyou", + "homepage": "http://postyou.de" } ], "support": { @@ -26,9 +25,9 @@ "php": "~7.0", "contao/core-bundle": "~4.3" }, - "autoload" : { + "autoload": { "psr-4": { - "Postyou\\ContaoABRStreamingBundle\\" : "src/" + "Postyou\\ContaoABRStreamingBundle\\": "src/" }, "classmap": [ "src/Resources/contao/" @@ -43,4 +42,4 @@ "extra": { "contao-manager-plugin": "Postyou\\ContaoABRStreamingBundle\\ContaoManager\\Plugin" } -} +} \ No newline at end of file diff --git a/src/ContaoManager/Plugin.php b/src/ContaoManager/Plugin.php index 3c1bc2b..c38f8e2 100644 --- a/src/ContaoManager/Plugin.php +++ b/src/ContaoManager/Plugin.php @@ -3,23 +3,27 @@ * * Extension for Contao Open Source CMS (contao.org) * - * Copyright (c) 2018-2018 POSTYOU + * Copyright (c) 2018-2019 POSTYOU * * @package * @author Markus Nestmann * @link http://www.postyou.de + * @license http://www.apache.org/licenses/LICENSE-2.0 */ + namespace Postyou\ContaoABRStreamingBundle\ContaoManager; + use Contao\ManagerPlugin\Bundle\BundlePluginInterface; use Contao\ManagerPlugin\Bundle\Config\BundleConfig; use Contao\ManagerPlugin\Bundle\Parser\ParserInterface; + class Plugin implements BundlePluginInterface { - /** - * Plugin for the Contao Manager. - * - * @author Markus Nestmann - */ + /** + * Plugin for the Contao Manager. + * + * @author Markus Nestmann + */ public function getBundles(ParserInterface $parser) { return [ @@ -27,4 +31,4 @@ public function getBundles(ParserInterface $parser) ->setLoadAfter(['Contao\CoreBundle\ContaoCoreBundle']) ]; } -} \ No newline at end of file +} diff --git a/src/PostyouContaoABRStreamingBundle.php b/src/PostyouContaoABRStreamingBundle.php index 72e4cbd..9baf580 100644 --- a/src/PostyouContaoABRStreamingBundle.php +++ b/src/PostyouContaoABRStreamingBundle.php @@ -3,7 +3,7 @@ * * Extension for Contao Open Source CMS (contao.org) * - * Copyright (c) 2018-2018 POSTYOU + * Copyright (c) 2018-2019 POSTYOU * * @package * @author Markus Nestmann @@ -11,8 +11,9 @@ * @license http://www.apache.org/licenses/LICENSE-2.0 */ namespace Postyou\ContaoABRStreamingBundle; + use Symfony\Component\HttpKernel\Bundle\Bundle; class PostyouContaoABRStreamingBundle extends Bundle { -} \ No newline at end of file +} diff --git a/src/Resources/classes/dashPlayerPlugin.php b/src/Resources/classes/dashPlayerPlugin.php index b2040df..1a2bae0 100644 --- a/src/Resources/classes/dashPlayerPlugin.php +++ b/src/Resources/classes/dashPlayerPlugin.php @@ -1,14 +1,23 @@ getName() == 'js_mediaelement') - { + if ($objTemplate->getName() == 'js_mediaelement') { $objTemplate->setName('js_mediaelement_dash'); } } -} \ No newline at end of file +} diff --git a/src/Resources/classes/tl_content.php b/src/Resources/classes/tl_content.php index 89c1edb..e159f49 100644 --- a/src/Resources/classes/tl_content.php +++ b/src/Resources/classes/tl_content.php @@ -1,5 +1,15 @@ id); + $objCte = ContentModel::findByPk($dc->id); - if ($objCte === null) - { - return; + if ($objCte === null) { + return; } - if ($objCte->type == 'abrstreaming') Message::addInfo(sprintf($GLOBALS['TL_LANG']['tl_content']['includeTemplate'], 'js_mediaelement')); + if ($objCte->type == 'abrstreaming') { + Message::addInfo(sprintf($GLOBALS['TL_LANG']['tl_content']['includeTemplate'], 'js_mediaelement')); + } } -} \ No newline at end of file +} diff --git a/src/Resources/contao/config/config.php b/src/Resources/contao/config/config.php index 41e4813..456bad4 100644 --- a/src/Resources/contao/config/config.php +++ b/src/Resources/contao/config/config.php @@ -3,15 +3,16 @@ * * Extension for Contao Open Source CMS (contao.org) * - * Copyright (c) 2018-2018 POSTYOU + * Copyright (c) 2018-2019 POSTYOU * * @package * @author Markus Nestmann * @link http://www.postyou.de + * @license http://www.apache.org/licenses/LICENSE-2.0 */ $GLOBALS['TL_CTE']['media']['abrstreaming'] = 'Postyou\ContaoABRStreamingBundle\ContentAbrstreaming'; $GLOBALS['TL_MIME']['mpd'] = array('application/dash+xml', 'iconMPEG.svg'); $GLOBALS['TL_MIME']['m3u8'] = array('application/x-mpegURL', 'iconMPEG.svg'); -$GLOBALS['TL_HOOKS']['parseTemplate'][] = array('Postyou\ContaoABRStreamingBundle\dashPlayerPlugin', 'myParseFrontendTemplate'); \ No newline at end of file +$GLOBALS['TL_HOOKS']['parseTemplate'][] = array('Postyou\ContaoABRStreamingBundle\dashPlayerPlugin', 'myParseFrontendTemplate'); diff --git a/src/Resources/contao/dca/tl_content.php b/src/Resources/contao/dca/tl_content.php index 4f87dd3..d30e864 100644 --- a/src/Resources/contao/dca/tl_content.php +++ b/src/Resources/contao/dca/tl_content.php @@ -1,32 +1,39 @@ &$GLOBALS['TL_LANG']['tl_content']['abrs_playerSRC'], - 'exclude' => true, - 'inputType' => 'fileTree', - 'eval' => array('filesOnly'=>true, 'multiple'=>true, 'fieldType'=>'checkbox', 'extensions' =>'mpd, m3u8, mp4, m4v, mov, wmv, webm, ogv', 'mandatory'=>true, 'tl_class'=>'clr autoheight'), - 'sql' => "blob NULL" +$GLOBALS['TL_DCA']['tl_content']['fields']['abrs_playerSRC'] = array( + 'label' => &$GLOBALS['TL_LANG']['tl_content']['abrs_playerSRC'], + 'exclude' => true, + 'inputType' => 'fileTree', + 'eval' => array('filesOnly'=>true, 'multiple'=>true, 'fieldType'=>'checkbox', 'extensions' =>'mpd, m3u8, mp4, m4v, mov, wmv, webm, ogv', 'mandatory'=>true, 'tl_class'=>'clr autoheight'), + 'sql' => "blob NULL" +); +$GLOBALS['TL_DCA']['tl_content']['fields']['abrs_playerSize'] = array( + 'label' => &$GLOBALS['TL_LANG']['tl_content']['playerSize'], + 'exclude' => true, + 'inputType' => 'text', + 'eval' => array('multiple'=>true, 'size'=>2, 'rgxp'=>'natural', 'nospace'=>true, 'tl_class'=>'w50'), + 'sql' => "varchar(64) NOT NULL default ''" ); -$GLOBALS['TL_DCA']['tl_content']['fields']['abrs_playerSize'] = array -( - 'label' => &$GLOBALS['TL_LANG']['tl_content']['playerSize'], - 'exclude' => true, - 'inputType' => 'text', - 'eval' => array('multiple'=>true, 'size'=>2, 'rgxp'=>'natural', 'nospace'=>true, 'tl_class'=>'w50'), - 'sql' => "varchar(64) NOT NULL default ''" +$GLOBALS['TL_DCA']['tl_content']['fields']['abrs_autoplay'] = array( + 'label' => &$GLOBALS['TL_LANG']['tl_content']['autoplay'], + 'exclude' => true, + 'inputType' => 'checkbox', + 'eval' => array('tl_class'=>'w50 m12'), + 'sql' => "char(1) NOT NULL default ''" ); -$GLOBALS['TL_DCA']['tl_content']['fields']['abrs_autoplay'] = array -( - 'label' => &$GLOBALS['TL_LANG']['tl_content']['autoplay'], - 'exclude' => true, - 'inputType' => 'checkbox', - 'eval' => array('tl_class'=>'w50 m12'), - 'sql' => "char(1) NOT NULL default ''" -); \ No newline at end of file diff --git a/src/Resources/contao/elements/ContentAbrstreaming.php b/src/Resources/contao/elements/ContentAbrstreaming.php index e6760e5..0ce3ade 100644 --- a/src/Resources/contao/elements/ContentAbrstreaming.php +++ b/src/Resources/contao/elements/ContentAbrstreaming.php @@ -1,128 +1,124 @@ abrs_playerSRC == '') - { - return ''; - } - $source = \StringUtil::deserialize($this->abrs_playerSRC); - - if (empty($source) || !\is_array($source)) - { - return ''; - } - - $objFiles = \FilesModel::findMultipleByUuidsAndExtensions($source, array('mpd', 'm3u8', 'mp4', 'm4v', 'mov', 'wmv', 'webm', 'ogv')); - - if ($objFiles === null) - { - return ''; - } - - // Display a list of files in the back end - if (TL_MODE == 'BE') - { - $return = '