Skip to content

Commit

Permalink
- updated copyright
Browse files Browse the repository at this point in the history
- removed core-bundle as requirement to be compatible with Contao 3.5 via composer
- moved settings into a subpalette
  • Loading branch information
bennyborn committed Oct 16, 2020
1 parent bf1155a commit 843aa8f
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 34 deletions.
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,12 @@ Santizes the filenames of files uploaded via the Contao File manager.
System requirements
--

* [Contao](https://github.com/contao/core) 3.2.5 or newer / successfully tested with Contao 4.3.9
* [Contao](https://github.com/contao/core) 3.5
* [Contao](https://github.com/contao/contao) 4.4 or newer


Installation & Configuration
--

* Create a folder named `proper-filenames` in `system/modules`
* Clone this repository into the new folder
* In the Backend go to System Settings and click `Check filenames` under `Upload settings`

**Additional step for Contao 4.X:**
Open `app/AppKernel.php` and add the following line to the $bundles array
```php
new Contao\CoreBundle\HttpKernel\Bundle\ContaoModuleBundle('proper-filenames', $this->getRootDir())
```
* Install via Contao Manager or Composer (`composer require numero2/contao-proper-filenames`)
* In the Backend go to `System Settings` and click `Check filenames` under `Upload settings`
8 changes: 3 additions & 5 deletions classes/CheckFilenames.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,22 @@
/**
* Contao Open Source CMS
*
* Copyright (c) 2005-2017 Leo Feyer
* Copyright (c) 2005-2020 Leo Feyer
*
* @package ProperFilenames
* @author Benny Born <[email protected]>
* @license LGPL
* @copyright 2017 numero2 - Agentur für Internetdienstleistungen
* @copyright 2020 numero2 - Agentur für digitales Marketing GbR
*/


/**
* Namespace
*/
namespace numero2\ProperFilenames;

use Ausi\SlugGenerator\SlugGenerator;
use Contao\CoreBundle\Slug\ValidCharacters;
use Contao\System;


class CheckFilenames extends \Frontend {


Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
"type": "contao-module",
"license": "LGPL-3.0-or-later",
"authors": [{
"name": "numero2 - Agentur für Internetdienstleistungen",
"name": "numero2 - Agentur für digitales Marketing GbR",
"homepage": "http://www.numero2.de"
}
],
"require": {
"contao/core-bundle": "4.*",
"contao-community-alliance/composer-plugin": "3.*",
"ausi/slug-generator": "1.*"
},
Expand Down
6 changes: 3 additions & 3 deletions config/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
/**
* Contao Open Source CMS
*
* Copyright (c) 2005-2017 Leo Feyer
* Copyright (c) 2005-2020 Leo Feyer
*
* @package ProperFilenames
* @author Benny Born <[email protected]>
* @license LGPL
* @copyright 2017 numero2 - Agentur für Internetdienstleistungen
* @copyright 2020 numero2 - Agentur für digitales Marketing GbR
*/


Expand All @@ -25,7 +25,7 @@
/**
* Register the classes
*/
ClassLoader::addClasses( array
ClassLoader::addClasses(array
(
// Classes
'numero2\ProperFilenames\CheckFilenames' => 'system/modules/proper-filenames/classes/CheckFilenames.php',
Expand Down
4 changes: 2 additions & 2 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
/**
* Contao Open Source CMS
*
* Copyright (c) 2005-2017 Leo Feyer
* Copyright (c) 2005-2020 Leo Feyer
*
* @package ProperFilenames
* @author Benny Born <[email protected]>
* @license LGPL
* @copyright 2017 numero2 - Agentur für Internetdienstleistungen
* @copyright 2020 numero2 - Agentur für digitales Marketing GbR
*/


Expand Down
4 changes: 2 additions & 2 deletions dca/tl_files.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
/**
* Contao Open Source CMS
*
* Copyright (c) 2005-2017 Leo Feyer
* Copyright (c) 2005-2020 Leo Feyer
*
* @package ProperFilenames
* @author Benny Born <[email protected]>
* @license LGPL
* @copyright 2017 numero2 - Agentur für Internetdienstleistungen
* @copyright 2020 numero2 - Agentur für digitales Marketing GbR
*/


Expand Down
24 changes: 14 additions & 10 deletions dca/tl_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,41 @@
/**
* Contao Open Source CMS
*
* Copyright (c) 2005-2017 Leo Feyer
* Copyright (c) 2005-2020 Leo Feyer
*
* @package ProperFilenames
* @author Benny Born <[email protected]>
* @license LGPL
* @copyright 2017 numero2 - Agentur für Internetdienstleistungen
* @copyright 2020 numero2 - Agentur für digitales Marketing GbR
*/

use Contao\System;
use numero2\ProperFilenames\CheckFilenames;


/**
* Add palettes to tl_settings
*/
$GLOBALS['TL_DCA']['tl_settings']['palettes']['__selector__'][] = 'checkFilenames';
$GLOBALS['TL_DCA']['tl_settings']['palettes']['default'] = str_replace(
',imageHeight',
',imageHeight,checkFilenames,doNotTrimFilenames,filenameValidCharacters,filenameValidCharactersLocale',
',imageHeight,checkFilenames',
$GLOBALS['TL_DCA']['tl_settings']['palettes']['default']
);

$GLOBALS['TL_DCA']['tl_settings']['subpalettes']['checkFilenames'] = 'filenameValidCharacters,filenameValidCharactersLocale,doNotTrimFilenames';


/**
* Add fields to tl_settings
*/
$GLOBALS['TL_DCA']['tl_settings']['fields']['checkFilenames'] = array(
'label' => &$GLOBALS['TL_LANG']['tl_settings']['checkFilenames'],
'inputType' => 'checkbox',
'eval' => array( 'tl_class' => 'w50 cbx' ),
'eval' => array( 'submitOnChange'=>true, 'tl_class' => 'w50 cbx' ),
'default' => true
);

$GLOBALS['TL_DCA']['tl_settings']['fields']['doNotTrimFilenames'] = array(
'label' => &$GLOBALS['TL_LANG']['tl_settings']['doNotTrimFilenames'],
'inputType' => 'checkbox',
'eval' => array( 'tl_class' => 'w50 cbx' ),
);

$GLOBALS['TL_DCA']['tl_settings']['fields']['filenameValidCharacters'] = array(
'label' => &$GLOBALS['TL_LANG']['tl_settings']['filenameValidCharacters'],
'inputType' => 'select',
Expand All @@ -56,3 +54,9 @@
},
'eval' => array( 'tl_class' => 'w50', 'includeBlankOption' => true, 'chosen' => true ),
);

$GLOBALS['TL_DCA']['tl_settings']['fields']['doNotTrimFilenames'] = array(
'label' => &$GLOBALS['TL_LANG']['tl_settings']['doNotTrimFilenames'],
'inputType' => 'checkbox',
'eval' => array( 'tl_class' => 'w50 cbx' ),
);

0 comments on commit 843aa8f

Please sign in to comment.