Repository: ckfinder/ckfinder-laravel-package Branch: master Commit: 266e31e17496 Files: 30 Total size: 62.2 KB Directory structure: gitextract_j_y8v1bc/ ├── .gitignore ├── LICENSE.md ├── README.md ├── composer.json ├── src/ │ ├── CKFinderMiddleware.php │ ├── CKFinderServiceProvider.php │ ├── Command/ │ │ └── CKFinderDownloadCommand.php │ ├── Controller/ │ │ └── CKFinderController.php │ ├── config.php │ └── routes.php └── views/ ├── browser.blade.php ├── samples/ │ ├── ckeditor.blade.php │ ├── full-page-open.blade.php │ ├── full-page.blade.php │ ├── index.blade.php │ ├── layout.blade.php │ ├── localization.blade.php │ ├── modals.blade.php │ ├── other-custom-configuration.blade.php │ ├── other-read-only.blade.php │ ├── plugin-examples.blade.php │ ├── popups.blade.php │ ├── skins-jquery-mobile.blade.php │ ├── skins-moono.blade.php │ ├── user-interface-compact.blade.php │ ├── user-interface-default.blade.php │ ├── user-interface-listview.blade.php │ ├── user-interface-mobile.blade.php │ └── widget.blade.php └── setup.blade.php ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ vendor/ _connector/ public/ composer.lock ================================================ FILE: LICENSE.md ================================================ Software License Agreement ========================== Copyright (c) 2023, CKSource Holding sp. z o.o. All rights reserved. CKFinder package for Laravel is licensed under the terms of the MIT license (see Appendix A). Trademarks ---------- CKFinder is a trademark of CKSource Holding sp. z o.o. All other brand and product names are trademarks, registered trademarks or service marks of their respective holders. Sources of Intellectual Property required by package ---------------------------------------------------- The installation instruction requires user to run the following command to download CKFinder separately (the file manager itself): ```bash artisan ckfinder:download ``` The downloaded CKFinder distribution is licensed under a separate CKFinder License. --- Appendix A: The MIT License --------------------------- The MIT License (MIT) Copyright (c) 2023, CKSource Holding sp. z o.o. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================


To integrate CKFinder with CKEditor 5 all you have to do is pass some additional configuration options to CKEditor:
ClassicEditor
.create( document.querySelector( '#editor2' ), {
ckfinder: {
// Use named route for CKFinder connector entry point
uploadUrl: '@{{ route('ckfinder_connector') }}?command=QuickUpload&type=Files'
}
} )
.catch( error => {
console.error( error );
} );
The sample below presents the result of the integration. Try pasting images from clipboard directly into the editing area as well as dropping images — the files will be saved on the fly by CKFinder.
To integrate CKFinder with CKEditor all you have to do is pass some additional configuration options to CKEditor:
CKEDITOR.replace( 'editor1', {
// Use named CKFinder browser route
filebrowserBrowseUrl: '@{{ route('ckfinder_browser') }}',
// Use named CKFinder connector route
filebrowserUploadUrl: '@{{ route('ckfinder_connector') }}?command=QuickUpload&type=Files'
} );
It is also possible to use CKFinder.setupCKEditor() as shown below, to automatically setup integration between CKEditor and CKFinder:
var editor = CKEDITOR.replace( 'ckfinder' );
CKFinder.setupCKEditor( editor );
The sample below presents the result of the integration. You can manage and select files from your server when creating links or embedding images in CKEditor 4 content. In modern browsers you may also try pasting images from clipboard directly into the editing area as well as dropping images — the files will be saved on the fly by CKFinder.
@stop @section('scripts') @stop ================================================ FILE: views/samples/full-page-open.blade.php ================================================The full page mode opens CKFinder using the entire page as the working area.
CKFinder.start();
Click the button below to open CKFinder in full page mode.
Open CKFinder @stop @section('scripts') @stop ================================================ FILE: views/samples/index.blade.php ================================================ @extends('ckfinder::samples/layout') @section('content')This page presents a few samples of CKFinder 3 features. Use the navigation menu on the left side to browse all samples.
For more detailed information about CKFinder and its features please refer to documentation pages:
In case of any issues or suggestions please feel free to contact us.
@stop ================================================ FILE: views/samples/layout.blade.php ================================================CKFinder interface is automatically displayed in the user's language (as set in the browser or operating system settings).
The language of the CKFinder UI can also be set manually by using the language configuration option.
At the moment many localizations are incomplete. Please feel free to provide translations for your native language. Your help will be much appreciated!
In the example below CKFinder is started in Brazilian Portuguese.
CKFinder.widget( 'ckfinder-widget', {
language: 'pt-br',
width: '100%',
height: 500
} );
@stop
@section('scripts')
@stop
================================================
FILE: views/samples/modals.blade.php
================================================
@extends('ckfinder::samples/layout')
@section('content')
The modal mode is similar to popup. The difference is that popups are opened using a separate browser window while in modal mode CKFinder is opened inside a modal container that is appended to current page document.
In some cases you may need more than one modal to handle multiple places that require selecting a file. Below you can find an example that fills each of the inputs with the URL of the selected file.
var button1 = document.getElementById( 'ckfinder-popup-1' );
var button2 = document.getElementById( 'ckfinder-popup-2' );
button1.onclick = function() {
selectFileWithCKFinder( 'ckfinder-input-1' );
};
button2.onclick = function() {
selectFileWithCKFinder( 'ckfinder-input-2' );
};
function selectFileWithCKFinder( elementId ) {
CKFinder.modal( {
chooseFiles: true,
width: 800,
height: 600,
onInit: function( finder ) {
finder.on( 'files:choose', function( evt ) {
var file = evt.data.files.first();
var output = document.getElementById( elementId );
output.value = file.getUrl();
} );
finder.on( 'file:choose:resizedImage', function( evt ) {
var output = document.getElementById( elementId );
output.value = evt.data.resizedUrl;
} );
}
} );
}
@stop
@section('scripts')
@stop
================================================
FILE: views/samples/other-custom-configuration.blade.php
================================================
@extends('ckfinder::samples/layout')
@section('content')
CKFinder provides many configuration options that can be changed to customize the application. For details please check the documentation.
In the example below the following options are set:
id sets the instance ID to custom-instance-id,thumbnailDefaultSize sets the default thumbnail size to 400px after CKFinder is started,width sets the widget width to 100% to use all available space,height sets the widget height to 500 pixels.CKFinder.widget( 'ckfinder-widget', {
id: 'custom-instance-id',
thumbnailDefaultSize: 400,
width: '100%',
height: 500
} );
@stop
@section('scripts')
@stop
================================================
FILE: views/samples/other-read-only.blade.php
================================================
@extends('ckfinder::samples/layout')
@section('content')
Read-only mode can be enabled in CKFinder with the readOnly
configuration option. The user will be able to browse the files but will not be able to introduce any changes. Thanks to this setting you will be able to use
CKFinder as an online gallery.
Note: This will only disable certain UI elements. In order to successfully block file uploads and modifications, or to set read-only permissions for particular folders, you will need to adjust ACL settings accordingly in the server-side configuration file.
CKFinder.widget( 'ckfinder-widget', {
readOnly: true,
width: '100%',
height: 500
} );
With a little bit of imagination it is possible to turn CKFinder into a very simple gallery. Here CKFinder is configured to open a file on double click, run without a toolbar and without the folders panel.
The code behind this setup is quite simple:
CKFinder.widget( 'ckfinder-widget2', {
displayFoldersPanel: false,
height: 500,
id: 'gallery',
readOnly: true,
readOnlyExclude: 'Toolbars',
thumbnailDefaultSize: 143,
width: '100%'
} );
@stop
@section('scripts')
@stop
================================================
FILE: views/samples/plugin-examples.blade.php
================================================
@extends('ckfinder::samples/layout')
@section('content')
The example below shows the StatusBarInfo plugin that displays basic information about the selected file in the application status bar.
You can find more plugin examples in the CKFinder sample plugins repository.
Please have a look at plugin documentation, too.
CKFinder.widget( 'ckfinder-widget', {
width: '100%',
height: 500,
plugins: [
// The path must be relative to the location of the ckfinder.js file.
'../samples/plugins/StatusBarInfo/StatusBarInfo'
]
} );
@stop
@section('scripts')
@stop
================================================
FILE: views/samples/popups.blade.php
================================================
@extends('ckfinder::samples/layout')
@section('content')
The popup mode is most suitable for selecting files that are stored on a server.
Click the button below to open the popup and choose any file. After that you will see basic information
about the file that was selected, including the URL.
Additionally, CKFinder supports a special file selection mode for images called Choose Resized. This feature allows you to resize the selected image to any size that is suitable for you. The CKFinder connector will automatically create a resized version of the image and return its URL.
In some cases you may need more than one popup to handle multiple places that require selecting a file. Below you can find an example that fills each of the inputs with the URL of the selected file.
var button1 = document.getElementById( 'ckfinder-popup-1' );
var button2 = document.getElementById( 'ckfinder-popup-2' );
button1.onclick = function() {
selectFileWithCKFinder( 'ckfinder-input-1' );
};
button2.onclick = function() {
selectFileWithCKFinder( 'ckfinder-input-2' );
};
function selectFileWithCKFinder( elementId ) {
CKFinder.popup( {
chooseFiles: true,
width: 800,
height: 600,
onInit: function( finder ) {
finder.on( 'files:choose', function( evt ) {
var file = evt.data.files.first();
var output = document.getElementById( elementId );
output.value = file.getUrl();
} );
finder.on( 'file:choose:resizedImage', function( evt ) {
var output = document.getElementById( elementId );
output.value = evt.data.resizedUrl;
} );
}
} );
}
@stop
@section('scripts')
@stop
================================================
FILE: views/samples/skins-jquery-mobile.blade.php
================================================
@extends('ckfinder::samples/layout')
@section('content')
CKFinder UI is based on jQuery Mobile so its look & feel can be changed using the jQuery Mobile Theme Roller. For more information about custom skins and Theme Roller please refer to CKFinder documentation.
CKFinder.widget( 'ckfinder-widget', {
width: '100%',
height: 600,
skin: 'jquery-mobile',
swatch: 'a'
} );
CKFinder.widget( 'ckfinder-widget', {
width: '100%',
height: 600,
skin: 'jquery-mobile',
swatch: 'b'
} );
@stop
@section('scripts')
@stop
================================================
FILE: views/samples/skins-moono.blade.php
================================================
@extends('ckfinder::samples/layout')
@section('content')
Moono is a default skin used in CKFinder that provides visual integration with CKEditor.
@stop @section('scripts') @stop ================================================ FILE: views/samples/user-interface-compact.blade.php ================================================ @extends('ckfinder::samples/layout') @section('content')It is possible to disable the folders panel and have folders displayed as icons in the main area of the application. In the example below this mode is initialized inside a widget, but it also works in all standalone modes.
CKFinder.widget( 'ckfinder-widget', {
displayFoldersPanel: false,
width: '100%',
height: 700
} );
@stop
@section('scripts')
@stop
================================================
FILE: views/samples/user-interface-default.blade.php
================================================
@extends('ckfinder::samples/layout')
@section('content')
By default folders are displayed in CKFinder in a folder tree panel, like in the example below.
@stop @section('scripts') @stop ================================================ FILE: views/samples/user-interface-listview.blade.php ================================================ @extends('ckfinder::samples/layout') @section('content')By default files are displayed in CKFinder as thumbnails. With list view enabled all files will be displayed as a list, one bellow the other. No image previews are available in this mode.
The list view can be enabled regardless of the selected user interface (Default/Compact/Mobile).
CKFinder.widget( 'ckfinder-widget', {
defaultViewType: 'list',
width: '100%',
height: 700
} );
@stop
@section('scripts')
@stop
================================================
FILE: views/samples/user-interface-mobile.blade.php
================================================
@extends('ckfinder::samples/layout')
@section('content')
Mobile user interface is enabled automatically when the width of the working area of the application gets below the value
defined in the uiModeThreshold
configuration option.
Note: This mode works best on mobile devices, as touch and swipe events are not enabled for desktop browsers.
@stop @section('scripts') @stop ================================================ FILE: views/samples/widget.blade.php ================================================ @extends('ckfinder::samples/layout') @section('content')Using the widget mode you can embed CKFinder directly on a page, as shown below.
CKFinder.widget( 'ckfinder-widget', {
width: '100%',
height: 700
} );
@stop
@section('scripts')
@stop
================================================
FILE: views/setup.blade.php
================================================