Skip to content

Commit

Permalink
Merge pull request #484 from helios-ag/updates
Browse files Browse the repository at this point in the history
various updates
  • Loading branch information
helios-ag authored Dec 1, 2024
2 parents 07fc0bf + 4d45454 commit 69440f1
Show file tree
Hide file tree
Showing 26 changed files with 363 additions and 293 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--
Thanks for your contribution! If you are proposing a new feature that is complex,
please open an issue first so we can discuss about it.
please open an issue first so we can discuss it.
Note: all your contributions adhere implicitly to the MIT license
-->
8 changes: 3 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
continue-on-error: false
strategy:
matrix:
php-version: ['7.4', '8.0', '8.1', '8.2']
php-version: ['8.1', '8.2', '8.3']
steps:
- name: 'Checkout code'
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: 'Install PHP with extensions'
uses: shivammathur/[email protected]
Expand All @@ -38,6 +38,4 @@ jobs:
composer update --no-interaction --prefer-dist --optimize-autoloader --prefer-stable
vendor/bin/simple-phpunit install
- name: 'Run tests'
env:
SYMFONY_DEPRECATIONS_HELPER: 'max[indirect]=10&max[total]=27'
run: vendor/bin/simple-phpunit -v
run: vendor/bin/phpunit
15 changes: 13 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,18 @@ Tests/log
Tests/Functional/cache
Tests/Functional/log
vendor
.phpunit.result.cache
.php-cs-fixer.cache
clover.xml
.vscode
.vscode
.phpunit.result.cache
###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###
/phpunit.xml
/bin
73 changes: 36 additions & 37 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
return (new PhpCsFixer\Config())
->setRiskyAllowed(false)
->setRules([
'@Symfony' => true,
'@PHP80Migration' => true,
'array_syntax' => ['syntax' => 'short'],
'@Symfony' => true,
'@PHP80Migration' => true,
'array_syntax' => ['syntax' => 'short'],
'combine_consecutive_unsets' => true,
// one should use PHPUnit methods to set up expected exception instead of annotations
'general_phpdoc_annotation_remove' => [
Expand All @@ -17,15 +17,15 @@
'expectedExceptionMessageRegExp',
],
],
'function_typehint_space' => false,
'no_empty_phpdoc' => true,
'global_namespace_import' => ['import_classes' => true, 'import_functions' => true, 'import_constants' => true],
'no_superfluous_phpdoc_tags' => ['allow_mixed' => false, 'allow_unused_params' => false],
'phpdoc_line_span' => ['property' => 'single'],
'heredoc_to_nowdoc' => true,
'list_syntax' => ['syntax' => 'short'],
'function_typehint_space' => false,
'no_empty_phpdoc' => true,
'global_namespace_import' => ['import_classes' => true, 'import_functions' => true, 'import_constants' => true],
'no_superfluous_phpdoc_tags' => ['allow_mixed' => false, 'allow_unused_params' => false],
'phpdoc_line_span' => ['property' => 'single'],
'heredoc_to_nowdoc' => true,
'list_syntax' => ['syntax' => 'short'],
'blank_line_before_statement' => ['statements' => ['if', 'break', 'continue', 'declare', 'return', 'throw', 'try', 'yield']],
'no_extra_blank_lines' => [
'no_extra_blank_lines' => [
'tokens' => [
'break',
'continue',
Expand All @@ -38,35 +38,35 @@
'curly_brace_block',
],
],
'echo_tag_syntax' => true,
'method_argument_space' => false,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => ['sort_algorithm' => 'alpha', 'imports_order' => ['const', 'class', 'function']],
'echo_tag_syntax' => true,
'method_argument_space' => false,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => ['sort_algorithm' => 'alpha', 'imports_order' => ['const', 'class', 'function']],
'php_unit_test_class_requires_covers' => true,
'phpdoc_align' => [
'phpdoc_align' => [
'tags' => [
'param', 'return', 'throws', 'type', 'var'
],
],
],
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_order' => true,
'phpdoc_no_alias_tag' => ['replacements' => ['link' => 'website']],
'phpdoc_summary' => false,
'phpdoc_to_comment' => false,
'phpdoc_types_order' => false, // breaks psalm-specific notation sometimes!
'semicolon_after_instruction' => true,
'single_blank_line_at_eof' => true,
'single_line_throw' => false,
'types_spaces' => false,
'binary_operator_spaces' => [
'default' => 'single_space',
'phpdoc_order' => true,
'phpdoc_no_alias_tag' => ['replacements' => ['link' => 'website']],
'phpdoc_summary' => false,
'phpdoc_to_comment' => false,
'phpdoc_types_order' => false, // breaks psalm-specific notation sometimes!
'semicolon_after_instruction' => true,
'single_blank_line_at_eof' => true,
'single_line_throw' => false,
'types_spaces' => false,
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => [
'=' => 'align_single_space_minimal',
'-=' => 'align_single_space_minimal',
'+=' => 'align_single_space_minimal',
'=>' => 'align_single_space_minimal',
'=' => 'align_single_space_minimal',
'-=' => 'align_single_space_minimal',
'+=' => 'align_single_space_minimal',
'=>' => 'align_single_space_minimal',
'===' => null,
'??=' => 'align_single_space_minimal',
],
Expand All @@ -79,6 +79,5 @@
])
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__ . '/src')
)
;
->in(__DIR__ . '/src')
);
52 changes: 26 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,42 +23,42 @@ Creation is inspired by simplicity and convenience of Finder program used in Mac
Recommended bundles to use with:


| FMTinyMCEBundle | FOSCKEditorBundle | TrsteelCkeditorBundle| FMSummernoteBundle |
| ------------------------|-------------|-----------------|-----------------|
|[![FMTinyMCEBundle](https://img.shields.io/badge/FMTinyMCEBundle-download-brightgreen.svg)](https://github.com/helios-ag/FMTinyMCEBundle)|[![FOSCKEditorBundle](https://img.shields.io/badge/FOSCKEditorBundle-download-orange.svg)](https://github.com/FriendsOfSymfony/FOSCKEditorBundle)|[![TrsteelCkeditorBundle](https://img.shields.io/badge/TrsteelCkeditorBundle-download-blue.svg)](https://github.com/trsteel88/TrsteelCkeditorBundle)|[![FMSummernoteBundle](https://img.shields.io/badge/FMSummernoteBundle-download-brightgreen.svg)](https://github.com/helios-ag/summernote-bundle)|
| FMTinyMCEBundle | FOSCKEditorBundle | FMSummernoteBundle |
| ------------------------|-------------|-----------------|
|[![FMTinyMCEBundle](https://img.shields.io/badge/FMTinyMCEBundle-download-brightgreen.svg)](https://github.com/helios-ag/FMTinyMCEBundle)|[![FOSCKEditorBundle](https://img.shields.io/badge/FOSCKEditorBundle-download-orange.svg)](https://github.com/FriendsOfSymfony/FOSCKEditorBundle)|[![FMSummernoteBundle](https://img.shields.io/badge/FMSummernoteBundle-download-brightgreen.svg)](https://github.com/helios-ag/summernote-bundle)|


**Table of contents**

- [Installation](#installation)
- [Step 1: Installation](#step-1-installation)
- [Step 2: Enable the bundle](#step-2-enable-the-bundle-optional)
- [Step 3: Import FMElfinderBundle routing file](#step-3-import-fmelfinderbundle-routing-file)
- [Step 4: Securing paths](#step-4-configure-your-applications-securityyaml)
- [Step 1: Installation](#step-1-installation)
- [Step 2: Enable the bundle](#step-2-enable-the-bundle-optional)
- [Step 3: Import FMElfinderBundle routing file](#step-3-import-fmelfinderbundle-routing-file)
- [Step 4: Securing paths](#step-4-configure-your-applications-securityyaml)
- [Basic configuration](#basic-configuration)
- [Add configuration options to your config.yaml](#add-configuration-options-to-your-configyaml)
- [Use multiple upload folder by instance](#use-multiple-upload-folder-by-instance)
- [Add configuration options to your config.yaml](#add-configuration-options-to-your-configyaml)
- [Use multiple upload folder by instance](#use-multiple-upload-folder-by-instance)
- [CORS support](/docs/cors-support.md)
- [Events listeners / subscribers](/docs/events-listeners-subscribers.md)
- [Events](/docs/events-listeners-subscribers.md#events)
- [Sub requests](/docs/events-listeners-subscribers.md#sub-requests)
- [Events](/docs/events-listeners-subscribers.md#events)
- [Sub requests](/docs/events-listeners-subscribers.md#sub-requests)
- [Elfinder Form Type](/docs/elfinder-form-type.md)
- [Configuration](/docs/elfinder-form-type.md#configuration)
- [EasyAdmin 2.x](/docs/elfinder-form-type.md#easyadmin-2x-integration)
- [EasyAdmin 3.x/4.x](/docs/elfinder-form-type.md#easyadmin-3x/4x-integration)
- [Configuration](/docs/elfinder-form-type.md#configuration)
- [EasyAdmin 2.x](/docs/elfinder-form-type.md#easyadmin-2x-integration)
- [EasyAdmin 3.x/4.x](/docs/elfinder-form-type.md#easyadmin-3x/4x-integration)
- [CKEditor integration](/docs/ckeditor-integration.md)
- [Installation](/docs/ckeditor-integration.md#step-1-installation)
- [Configuration](/docs/ckeditor-integration.md#step-2-configure-ckeditor-setting-via-settingsyml-or-through-form-builder)
- [Installation](/docs/ckeditor-integration.md#step-1-installation)
- [Configuration](/docs/ckeditor-integration.md#step-2-configure-ckeditor-setting-via-settingsyml-or-through-form-builder)
- [TinyMCE integration](/docs/tinymce-integration.md)
- [Integration with TinyMCE 3](/docs/tinymce-integration.md#tinymce-3x)
- [Integration with TinyMCE 4](/docs/tinymce-integration.md#tinymce-4x)
- [Integration with TinyMCE 3](/docs/tinymce-integration.md#tinymce-3x)
- [Integration with TinyMCE 4](/docs/tinymce-integration.md#tinymce-4x)
- [Summernote integration](/docs/summernote-integration.md)
- [Advanced configuration](/docs/advanced-configuration.md)
- [Custom configuration provider](/docs/advanced-configuration.md#custom-configuration-provider)
- [Custom loader](/docs/advanced-configuration.md#custom-loader)
- [Plugins](/docs/advanced-configuration.md#plugins)
- [Service as volume driver](/docs/advanced-configuration.md#symfony-service-as-a-volume-driver)
- [Flysystem configuration](/docs/advanced-configuration.md#flysystem-configuration)
- [Custom configuration provider](/docs/advanced-configuration.md#custom-configuration-provider)
- [Custom loader](/docs/advanced-configuration.md#custom-loader)
- [Plugins](/docs/advanced-configuration.md#plugins)
- [Service as volume driver](/docs/advanced-configuration.md#symfony-service-as-a-volume-driver)
- [Flysystem configuration](/docs/advanced-configuration.md#flysystem-configuration)
- [Configuration dump](/docs/configuration-dump.md)

## Installation
Expand Down Expand Up @@ -156,12 +156,12 @@ fm_elfinder:
* **default** - instance of elfinder, can be used to define multiple configurations of ElFinder, allows simultaneous configuration for different types of WYSIWYG editors in your project
* **path** - define root directory for the files inside web/ directory, default is "uploads". Make sure to set proper write/read and owner permissions to this directory.
* **url** - url to be prefixed to image path, for displaying. Can be either `absolute` or `relative`. If absolute, you can use `{homeFolder}` string as placeholder which will be replaced automatically. If relative, it will be prefixed with the applications base-url. If left blank, url will be the base-url, append with the value of the 'path' parameter
* **driver** - can be LocalFileSystem, FTP or MySQL, Flysystem, S3 and etc, check class FM\ElfinderBundle\DependencyInjection\Configuration
* **driver** - can be LocalFileSystem, FTP or MySQL, Flysystem, S3 and etc, check class FM\ElfinderBundle\DependencyInjection\Configuration
* **locale** - locale determines, which language, ElFinder will use, to translate user interface, default is current request locale
* **cors_support** - allows cross domain responses handling (default false)
* **editor** - determines what template to render, to be compatible with WYSIWYG web editor, currently supported options are:
"ckeditor" (to use with FOSCKEditorBundle or TrsteelCkeditorBundle), "fm_tinymce" for tinymce4 (to use with FMTinyMCEBundle), "form" for form type, "simple" for standalone and "custom" for custom template.
How to configure CKEDitor and TinyMCE to work with this bundle, will be explained further in this document.
"ckeditor" (to use with FOSCKEditorBundle or TrsteelCkeditorBundle), "fm_tinymce" for tinymce4 (to use with FMTinyMCEBundle), "form" for form type, "simple" for standalone and "custom" for custom template.
How to configure CKEDitor and TinyMCE to work with this bundle, will be explained further in this document.
* **editor_template** - define template to render when editor is set to "custom".
* **connector** - root node for defining options for elfinder root directories.
* **roots** - define "virtual directories" that reflect directories in your project.
Expand Down
41 changes: 31 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,20 @@
"exclude": ["/tests", "./github"]
},
"require": {
"php": "^7.4 || ^8.0",
"php": "^8.1",
"ext-json": "*",
"symfony/framework-bundle": "^4.4 || ^5.0 || ^5.2 || ^6.0 || ^7.0",
"symfony/twig-bundle": "^4.4 || ^5.0 || ^5.2 || ^6.0 || ^7.0",
"symfony/form": "^4.4 || ^5.0 || ^5.2 || ^6.0 || ^7.0",
"symfony/asset": "^4.4 || ^5.0 || ^5.2 || ^6.0 || ^7.0",
"symfony/framework-bundle": "^6.4 || ^7.0",
"symfony/twig-bundle": "^6.4 || ^7.0",
"symfony/form": "^6.4 || ^7.0",
"symfony/asset": "^6.4 || ^7.0",
"symfony/flex": "^2",
"studio-42/elfinder": "~2.1.62"
},
"require-dev" : {
"symfony/phpunit-bridge": "^7.0.1",
"matthiasnoback/symfony-config-test": "^4.0",
"matthiasnoback/symfony-dependency-injection-test": "^4.1",
"symfony/finder": "^4.4 || ^5.0 || ^5.2 || ^6.0 || ^7.0",
"symfony/phpunit-bridge": "^6.4 || ^7.0.1",
"matthiasnoback/symfony-config-test": "^5.2",
"matthiasnoback/symfony-dependency-injection-test": "^6.0",
"symfony/finder": "^6.4 || ^7.0",
"php-coveralls/php-coveralls": "^2.0",
"friendsofphp/php-cs-fixer": "dev-master"
},
Expand All @@ -43,6 +44,20 @@
"barryvdh/elfinder-flysystem-driver": "Flysystem driver for elfinder",
"spatie/flysystem-dropbox": "Dropbox 2 Driver for Flysystem"
},
"config": {
"sort-packages": true,
"preferred-install": {
"symfony/doctrine-bridge": "source",
"*": "dist"
},
"allow-plugins": {
"composer/installers": true,
"symfony/flex": true,
"symfony/runtime": true,
"composer/package-versions-deprecated": true,
"oomphinc/composer-installers-extender": true
}
},
"autoload": {
"psr-4": { "FM\\ElfinderBundle\\": "src/" }
},
Expand All @@ -51,7 +66,13 @@
},
"extra": {
"branch-alias": {
"dev-master": "12.0-dev"
"dev-master": "13.0-dev"
}
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
}
}
}
49 changes: 26 additions & 23 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="tests/autoload.php"
colors="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
>
<coverage includeUncoveredFiles="true">
<include>
<directory>./</directory>
</include>
<exclude>
<directory>./src/Controller</directory>
<directory>./src/Resources</directory>
<directory>./tests</directory>
<directory>./vendor</directory>
</exclude>
<report>
<clover outputFile="./clover.xml"/>
</report>
</coverage>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="tests/autoload.php"
colors="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd"
cacheDirectory=".phpunit.cache"
>
<!-- <coverage>-->
<!-- <report>-->
<!-- <clover outputFile="./clover.xml"/>-->
<!-- </report>-->
<!-- </coverage>-->
<php>
<server name="KERNEL_DIR" value="./tests/Functional"/>
<ini name="error_reporting" value="-1"/>
<!-- ###+ symfony/framework-bundle ### -->
<env name="APP_ENV" value="dev"/>
<env name="APP_SECRET" value=""/>
<!-- ###- symfony/framework-bundle ### -->
</php>
<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
</listeners>
<testsuites>
<testsuite name="FMElfinderBundle test suite">
<directory>./tests</directory>
Expand All @@ -34,4 +26,15 @@
<logging>
<!-- and this is where your report will be written -->
</logging>
<source>
<include>
<directory>./</directory>
</include>
<exclude>
<directory>./src/Controller</directory>
<directory>./src/Resources</directory>
<directory>./tests</directory>
<directory>./vendor</directory>
</exclude>
</source>
</phpunit>
7 changes: 2 additions & 5 deletions src/Bridge/ElFinderBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ public function setSession($session)
$this->session = $session;
}

/**
* @return array
*/
public function getVolumes()
public function getVolumes(): array
{
return $this->volumes;
}
Expand All @@ -43,7 +40,7 @@ protected function mountVolumes($opts)
if (isset($o['service'])) {
$driver = $o['service'];

if (is_object($driver) && $driver instanceof elFinderVolumeDriver) {
if ($driver instanceof elFinderVolumeDriver) {
$volume = $driver;
unset($opts['roots'][$i]);
}
Expand Down
Loading

0 comments on commit 69440f1

Please sign in to comment.