=== Library Viewer === Contributors: pexlechris Plugin Name: Library Viewer Plugin URI: https://www.pexlechris.dev/library-viewer Author: Pexle Chris Author URI: https://www.pexlechris.dev Tags: FTP, file manager, file list, directory listing Version: 1.2.3 Requires at least: 3.0.0 Tested up to: 5.6 Requires PHP: 5.3.3 License: GPLv2 License URI: http://www.gnu.org/licenses/gpl-2.0.html This is a File & Folder Viewer of FTP folder: yoursite.com/library . So using the shortcode [library-viewer], you can print the containing folders & files of your library in front-end. Copyrights & License: Copyright 2020 Pexle Chris(email: info@pexlechris.dev) Library Viewer is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. Library Viewer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA02110-1301USA == Description == Stay Tuned! **Library Viewer 2.0.0** is on the way. With Library Viewer you can display the containing files and the containing folders of a "specific folder" of your (FTP) server to your users in the front-end. The **significant difference** from other similar plugins is that: 1. You can allow users to **view that the files exist**, but **cannot open them if they are not logged in** (or if they are not administrators, or authors etc...). 2. You can allow users to view files in a **custom viewer or redirect them** through a RESTful web service of your choice(examples exists below). [DEMO](https://www.pexlechris.dev/library-viewer/demo-wp) For this plugin (the free version), the "specific folder" is the folder "library" of your httpdocs(yoursite.com/library). If you want to display other folder (and its files) that is nοt contained in yoursite.com/library , you need to buy the Library Viewer Pro. You can **buy Library Viewer Pro** from this link: [www.pexlechris.dev/library-viewer-pro](https://www.pexlechris.dev/library-viewer/pro-wp) This plugin adds the [library-viewer] shortcode in your WordPress site! So the only thing that you must do to display the folders and files in the front-end is to add this shortcode in a post, or page etc. The [library-viewer] shortcode get **optional parameters** that extend the functionality of plugin: 1) have_file_access 2) my_doc_viewer 3) login_page 4) path (ONLY IN PRO) = have_file_access parameter use cases = * **`have_file_access="all"`** : public access, all people can open the files. "all" is the DEFAULT value. * **`have_file_access="administrator"`** : only administrators can open the files. * **`have_file_access="administrator,author,subscriber"`** : only administrators, authors and subscribers can open the files. * **`have_file_access="edit_posts"`** : only those that have the **CAPABILITY** to edit posts, can open the files. * **`have_file_access="subscriber,edit_posts"`** : only subscribers and those that have the **CAPABILITY** to edit posts, can open the files. * **`have_file_access="logged_in"`** : all logged in users can open the files. = my_doc_viewer parameter use cases = NOTE: If have_file_access is NOT in the DEFAULT state, my_doc_viewer does NOTHING. * **`my_doc_viewer="default"`** : the files open in the default viewer of your browser or they are downloaded. "default" is the DEFAULT value. * **`my_doc_viewer="library-viewer"`** : the files open in the Library Viewer' viewer * **`my_doc_viewer="https://docs.google.com/viewerng/viewer?url="`** : the files open with Google Doc Viewer (The advantage of google doc viewer is that opens ALL the files -pdf, doc,docx,ppt- in the browser, in smartphones too) * **`my_doc_viewer="http://ouo.io/qs/Is36k2da?s="`** : the files open via paid shortener * Or you can use **your custom viewer**. = login_page parameter use cases = If have_file_access is NOT in the DEFAULT state and you had set your custom login page, you can define it in this parameter, for example: * **`login_page="wp-login.php"`** : the user will be redirected in the default WP login page to log in. "wp-login.php" is the DEFAULT value. * **`login_page="login"`** if your login page is located in this link: yoursite.com/login/ , so the user will be redirected in your login page to log in. * **`login_page="my-account"`** if your login page is located in this link: yoursite.com/my-account/ , so the user will be redirected in your login page to log in. * **`login_page="pages/login"`** if your login page is located in this link: yoursite.com/pages/login/ , so the user will be redirected in your login page to log in. = path parameter use cases (ONLY IN PRO) = * **`path="wp-content/uploads"`** : containing folders & files of *uploads* directory are being displayed in the front-end. *wp-content* nowhere is being displayed! * **`path="wp-content"`** : containing folders & files of *wp-content* directory are being displayed in the front-end * **`path="wp-content/uploads/2015"`** : containing folders & files of *2015* directory are being displayed in the front-end. *wp-content/uploads* anywhere is being displayed! * **`path="root"`** : All the folders and files of your site are being displayed in the front-end. == Shortcode Examples == You can find shortcode examples use cases in the plugin's FAQs... == Other Details == * The algorithm does not show in the front-end folders that contains in their name the string "hidden-folder". Also does not show .php , .ini files and files that contains in their name the string "hidden-file". So if you don't want to displaying an existing folder or file, you can rename it appropriately! * If a folder or file contains a space character (" ") in its name, in the url the space is replaced by "–" for beauty reasons. It is much prettier this link: ...LV/library/my–file.pdf than this: ...LV/library/my%20file.pdf If you want to set an other symbol to replace the spaces in the urls, you need to buy Library Viewer Pro (See below)! * If have_file_access is NOT in the DEFAULT state, files open with plugin viewer. All the files that are supported by WordPress Core opens in new tab of browser, all others are downloaded (this from PC, from smartphone pdf files are downloaded). If you want to add support for others files (that browser can open) or make the files to be downloaded, use the LV__mime_types wp filter. See FAQs for details * If you want to add text above the front-end folders or below the front-end files, you can create via FTP a file with name "include.php" in the FTP folder that you want texts to be shown in front-end. HTML tags are allowed! Your texts must be values of php variables ($text_at_beginning , $text_at_end respectively) as you can see below: ` deny from all ` = Is Library Viewer' file viewer supports all mime types? From 1.1.2, the Library Viewer' file viewer supports all mime types that wordpress supports. These that included in the function: wp_get_mime_types() If you want to add support for mime types that are not included, use the WP filter: LV__mime_types to include them. Example below: ` add_filter('LV__mime_types', function($mime_types){ //add support for C++ files(C++ files' extenstion: .cpp) $mime_types['cpp']='text/x-c'; return $mime_types; }); ` = I want all files to be downloaded. Is that possible? Yes, from 1.1.2 this functionality is supported! You need to use the Library Viewer' file viewer (my_doc_viewer="library-viewer") and to add the following hook in your function.php ` add_filter('LV__mime_types', function($mime_types){ return array(); }); ` = I have a proposal for a new functionality of this plugin. Can I suggest it to you? = Yes. I need new ideas to improve my plugin. Send it to me via email or via [support forum](https://wordpress.org/support/plugin/library-viewer/) == Installation == 1. Download the plugin from [Official WP Plugin Repository](https://wordpress.org/plugins/library-viewer/) 2. Upload Plugin from your WP Dashboard ( Plugins>Add New>Upload Plugin ) the library-viewer.zip file. 3. Activate the plugin through the 'Plugins' menu in WordPress Dashboard 4. Add to a new or existing page/post (or widget etc.) the shortcodes [library-viewer] with the parameters of your choice. == Changelog == = 1.2.3 = * Tested up to WP 5.6 * [Enhancement]: In filter `LV__folder_html` introduced the $attributes parameter * [New]: filter `LV__file_html` introduced = 1.2.2 = * Tested up to WP 5.5.3 * [Enhancement]: Change Library Viewer Pro URL in plugins' page on dashboard = 1.2.1 = * [Bug Fix]: False Positive: shortcode [library-viewer] seams to be used more than 1 times in the same page, but not = 1.2.0 = * Tested up to WP 5.5.1 * [New]: LV__folder_was_viewed wordpress action was added in the code * [Enhancement]: From 1.2.0, the shortcode settings are saved in database, not in files. Also, the folder /wp-content/uploads/library-viewer will be deleted! * [Bug Fix]: Now Library Viewer' shortcode is supported in the homepage too * [New]: library-viewer has been added to the available values that my_doc_viewer can get * [Bug Fix in PRO]: The shortcode [library-viewer] cannot be used more than 1 times in the same page. This feature is available in Library Viewer Pro = 1.1.2 = * LV__mime_types wordpress filter was added in the code * LV__file_was_viewed wordpress action was added in the code * Tested up to WP 5.4.2 = 1.1.1 = * Some errors has been fixed! = 1.1.0 = * now is possible to restrict users from open files by a **capability** using the have_file_access parameter * php die() replaced by wp_die() for more pretty messages * enhancement in code * delete folder library-viewer of your uploads folder on uninstall * now you can more easily add an icon in the front of a file using CSS = 1.0.7 = * Library Viewer has been tested up to WP 5.3.2 * PHP Notices fixed = 1.0.6 = * Folders icons NOW are printed by css background-image attribute * Compatibility with sites that exist in a subdirectory fixed = 1.0.5 = * SECURITY PATCH (Please update NOW) = 1.0.3 = * Library Viewer has been tested up to WP 5.2.3 * readme file was translated in Greek * Compatibility with Visual Composer have been tested and works fine * Instruction to fix the conflict with Remove Uppercase Ascents Plugin added in FAQ * Go Back button have been added in error messages = 1.0.2 = * Library Viewer has been tested up to WP 5.2.2 * Link notice for Library Viewer Pro has been added in the backend (WP Plugins Page) * Plugin URI has been fixed * A screenshot has been added in the Official WP Page of Library Viewer Plugin * Minor typo fixes in the readme file and Official WP Page of Library Viewer Plugin = 1.0.1 = * Compatibility have added for most common special characters(**+** , **&** , **'** , **.**) * Redirect waiting time to login is now 5 seconds (if you want to change this you need to buy the [Library Viewer Pro](https://www.pexlechris.dev/library-viewer/pro-wp)) * The ability of encryption of the real path of your folder (with hash technique) moved to [Library Viewer Pro](https://www.pexlechris.dev/library-viewer/pro-wp) = 1.0.0 = * Initial Release.