Library Viewer

Περιγραφή

Spoiler:
LIBRARY VIEWER FILE MANAGER ADD-ON has been released! Check it 😉

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.

Η σημαντική διαφορά από άλλα παρόμοια πρόσθετα είναι ότι:
1. Μπορείτε να επιτρέψετε στους χρήστες να βλέπουν ότι υπάρχουν αρχεία, αλλά να μην μπορούν να τα ανοίξουν αν δεν είναι συνδεδεμένοι (ή αν δεν είναι διαχειριστές ή συγγραφείς κ.λπ…)
2. Μπορείτε να επιτρέψετε στους χρήστες να προβάλλουν αρχεία σε προσαρμοσμένο πρόγραμμα προβολής εγγράφων ή να ανακατευθύνονται μέσω μιας RESTful υπηρεσίας της επιλογής σας (παραδείγματα υπάρχουν παρακάτω).

DEMO

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 isn’t contained in yoursite.com/library , you need to use the path parameter of Library Viewer Pro.

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, page, widget etc.

The [library-viewer] shortcode get optional parameters that extend the functionality of plugin:

Parameters Documentation

  PARAMETERS DOCUMENTATION AND USE CASES

  PARAMETERS OF LIBRARY VIEWER

  • have_file_access (have_file_access parameter determines which user have access to view the files.)
  • my_doc_viewer (my_doc_viewer parameter determines in which viewer the file will be opened.)
  • login_page (login_page parameter defines the login page that user will be redirected -if need it-, to log in.)

  PARAMETERS OF LIBRARY VIEWER PRO

  • path (path parameter allow us to choose what folder we want to display in the Library in the front-end. When we say, folder, we mean folder’s contents i.e. containing folders and files of this folder.)
  • waiting_seconds (waiting_seconds parameter sets the seconds of user is waiting the redirection to login and see the file (0: for instant redirect).)
  • breadcrumb (breadcrumb parameter determines if breadcrumb will be displayed in the Library in front-end or not.)
  • hidden_folders (hidden_folders determines which folders will not be displayed and will not be accessible by Library in the front-end.)
  • shown_folders (shown_folders parameter determines which folders will be displayed and will be accessible by Library in the front-end.)
  • hidden_files (hidden_files determines which files will not be displayed and will not be accessible by Library in the front-end.)
  • shown_files (shown_files parameter determines which files will be displayed and will be accessible by Library in the front-end.)
  • url_suffix (url_suffix allow you to add a suffix in the URL, so you can use the [library-viewer] shortcode more than one time in the same page.)

  PARAMETERS OF LIBRARY VIEWER FILE MANAGER ADD-ON

  • delete_folder (delete_folder parameter determines which user can delete a folder.)
  • delete_file (delete_file parameter determines which user can delete a file.)
  • rename_folder (rename_folder parameter determines which user can rename a folder.)
  • rename_file (rename_folder parameter determines which user can rename a file.)
  • create_folder (create_folder parameter determines which user can create a folder.)
  • upload_file (upload_file parameter determines which user can upload a file.)
  • unzip_file (unzip_file parameter determines which user can unzip a zip file.)
  • download_folder (download_folder parameter determines which user can download a folder as a zip file.)
  • download_file (download_file parameter determines which user can download a file.)

 
PARAMETERS DOCUMENTATION AND USE CASES

 

Hooks Documentation

From 2.0.0 version and then, there are many hooks that you can customize the functionality of this plugin.
You can read more in HOOKS DOCUMENTATION
Read also how to add PHP hooks in your WordPress Site in my blog

Άλλες Πληροφορίες

  • 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 display an existing folder or file, you can rename it appropriately!
    In addition, With Library Viewer Pro, you can set the names that you don’t (and you do) want to be displayed in the front-end using appropriate shortcode parameters.
  • 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, view more in the FAQ below.
  • In addition, with the LIBRARY VIEWER PRO you can,
    • customize the URLs of library viewer, with the hooks and the parameters.
    • you can display folders & files of a directory (in FTP) of your choice, not only library directory (yoursite.com/library)
    • you can hide the breadcrumb with just a shortcode parameter.
    • you can show/hide the folders and files of your choice.
  • Also, with the LIBRARY VIEWER FILE MANAGER ADD-ON you can,
    • give the ability to your users to have their own library and to upload and edit files.
    • use the library as file manager for your admins (you may need also Library Viewer Pro, and to restrct the WP page from other users)

Στιγμιότυπα

  • ο φάκελος library πρέπει να βρίσκεται στη ρίζα (ακριβώς μέσα) του FTP σέρβερ
  • Δεν εμφανίζονται όλα τα αρχεία και οι φάκελοι στην βιβλιοθήκη της ιστοσελίδας σας λόγω των ειδικών ονομάτων τους (hidden-folder, hidden-file, .php κ.λπ.)
  • Η string-τιμή της μεταβλητής $text_at_beginning προβάλλεται μεταξύ του breadcrumb και των φακέλων, η string-τιμή της μεταβλητής $text_at_end προβάλλεται κάτω από τους φακέλους & τα αρχεία.
  • With Library Viewer File Manager Add-On, you can give the ability to some of your users to manage the library from the front-end.

Εγκατάσταση

  1. Κάντε λήψη του plugin από το Επίσημο WP Αποθετήριο Προσθέτων
  2. Μεταφορτώστε το πρόσθετο από τον Πίνακα ελέγχου του WP ( Πρόσθετα>Προσθήκη νέου>Προσθήκη Προσθέτου ) το αρχείο library-viewer.zip.
  3. Ενεργοποιήστε το πρόσθετο μέσω του μενού ‘Πρόσθετα’ στον Πίνακα Ελέγχου του WordPress
  4. Προσθέστε σε μια νέα ή υπάρχουσα σελίδα/άρθρο (ή widget κ.λπ.) τον shortcode [library-viewer] με τις παραμέτρους της επιλογής σας.

Συχνές Ερωτήσεις

Can I forbid the direct access in the files of the library? I want only via library files can be accessible.

With Library Viewer Pro, you can! See this support topic: wordpress.org/support/topic/executable-pdf-file

Can I hide an existing folder or file of FTP folder from the front-end library?

Ναι. Παρακαλώ διαβάστε προσεκτικά την ενότητα «Άλλες Λεπτομέρειες» του προσθέτου.

How can I deny users to execute php files in folders of my library?

You need to add the following code in the .htaccess file of the folder that you want to deny users execute php files

  <Files *.php>
  deny from all
  </Files>

I have put the shortcode in a page but it doesn’t work when I click in a folder or a file. Why?

PLAIN PERMALINKS ARE NOT SUPPORTED. Please change your permalink from /wp-admin/options-permalink.php to something else.
The problem is with the get parameters. Get parameters are not fully supported at all. Maybe this is the reason that doesn’t work efficiently

Το plugin μου λέει ότι ένας φάκελος ή ένα αρχείο δεν υπάρχει, αλλά υπάρχει! Γιατί;

This is maybe because of some special characters that are not supported as names of folders and files such as %.
In this case, contact me via email or via support forum to find a solution!
In addition, if you use the plugin Remove Uppercase Ascents and a CSS code like .library-viewer–folder{text-transform: uppercase;} maybe this cause the problem. The solution in this case is to use instead this CSS code: .library-viewer–folder h3 a{text-transform: uppercase;}

Υπάρχουν παραδείγματα χρήσης shortcode;

You can test your own use cases in the DEMO

Μπορώ να προσθέσω το δικό μου κείμενο μέσα στους φακέλους της front-end βιβλιοθήκης μου;

Yes. 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:

  <?php
  $text_at_beginning = "My text above front-end folders";
  $text_at_end = "My text below front-end files";
  ?>

 
Also, you can use the hooks lv_folder_text_at_beginning and lv_folder_text_at_end respectively for this scope.

Με ποιους Page Builders το Library Viewer είναι συμβατό;

Library Viewer have been tested with TinyMCE (Classic Editor) , Gutenberg , WPBakery, Visual Composer, Elementor and works fine!
Generally can be used, everywhere that shortcodes are accepted…

Μπορώ να αλλάξω τα χρώματα ή τις γραμματοσειρές που χρησιμοποιεί το πρόσθετο;

Ναι. Αλλά μόνο με χρήση απλών εντολών CSS αυτήν την στιγμή. Συνεπώς μπορείτε να προσθέσετε το δικό σας css από τον Προσαρμογέα του WP (από Πρόσθετη CSS)

Πώς να ανεβάσω αρχεία και να δημιουργήσετε νέους φακέλους;

You can do this via FTP/cPanel or you can buy the Library Viewer File Manager Add-on to manage the folder from the front-end.

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.
Read more in HOOKS DOCUMENTATION
Read also how to add PHP hooks in your WordPress Site in my blog

I want all files to be downloaded. Is that possible?

Yes, you need to use the Library Viewer’ file viewer (my_doc_viewer=”library-viewer”) and to add the following hook in your functions.php

  add_filter('lv_mime_types', function(){
    return array();
  });

Read how to add PHP hooks in your WordPress Site in my blog

Έχω μια πρόταση για μια νέα λειτουργικότητα αυτού του προσθέτου. Μπορώ να σας την προτείνω;

Ναι. Χρειάζομαι νέες ιδέες για να βελτιώσω το πρόσθετό μου. Στείλτε τες σε εμένα μέσω ηλεκτρονικό ταχυδρομείο ή μέσω του φόρουμ υποστήριξης

Κριτικές

20 Φεβρουαρίου 2022
A very handy plug-in that lets you display and use the contents of a directory. You can deal with the contents of the directory with the use of ftp. Very easy to use, very lightweight, excellent. Thank you
11 Οκτωβρίου 2021
This plugin does exactly what it needs to without the bloat. Lightweight and simple. I purchased the pro version and had a small issue with my setup, but the plugin developer was very fast and responsive with support and sorted out my problem very quickly!
27 Μαρτίου 2021
This plugin do exactly all that says with easy setup and work very fast.
Ανάγνωση όλων των 8 κριτικών

Συνεισφέροντες & Προγραμματιστές

“Library Viewer” είναι λογισμικό ανοιχτού κώδικα. Οι παρακάτω έχουν συνεισφέρει στη δημιουργία του.

Συντελεστές

Σύνοψη αλλαγών

2.0.5

  • [New]: 2 new globals values added in the File class. file_folder_real_path, file_folder_abs_path
  • [New]: html attribute library-viewer-name has been added in the div with class library-viewer--container
  • [Enhancement]: Better message if a shortcode used more than 1 times in the same page.
  • [Bug Fix]: Fix a minor php warning when viewing a file with plugin’s file viewer
  • [Bug Fix]: Compatibility fixed with Library Viewer Pro

2.0.4

  • Tested up to WP 5.9.2
  • [Bug Fix]: Compatibility fixed with Library Viewer File Manager Add-On
  • [Bug Fix]: Load textdomain in order to be able to get translations from wordpress.org

2.0.3

  • Tested up to WP 5.8.1
  • [New]: lv_filter_global_{$parameter} filter introduced. With this filter, you can filter the parameters BEFORE the rest globals’ initialization.
  • [New]: lv_breadcrumb_html filter introduced. With this filter, you can filter the html of whole breadcrumb.
  • [New]: If library folder doesn’t exist, will be created automatically when the shortcode will called in the front-end.
  • [Bug Fix]: In the $globals array that was passed in the hooks, value current_viewer was not existed. Now exists.
  • [Enhancement]: /languages/library-viewer.pot language template file has been created.
  • [Enhancement]: On the filter lv_file_anchor_html, the variable $file_anchor_href has been also added in the array $file (2nd parameter). View hook’ documentation for more info.
  • [Enhancement]: .library-viewer--folder h3{margin-top: 0; display: inline-block;} css has been added.
  • [Enhancement]: $file_abs_path is added in the $all_files parameter ( $all_files[‘file_abs_path’] ) in the parameters of hooks: lv_containing_files, lv_file_icon_html, lv_file_html, lv_before_file, lv_after_file.
  • [Enhancement]: File icon element has been moved into the html element.
  • [Deprecated]: The filter lv_shortcode_class_name has been replaced by lv_shortcode_class_names. This is an advanced hook…
  • [Deprecated]: The filter lv_file_viewer_class_name has been replaced by lv_file_viewer_class_names. This is an advanced hook…

2.0.2

  • [Deprecated]: breadcrumb value has been removed from Library Viewer globals parameter of all hooks. From now, there is only in Library Viewer Pro’s hooks
  • [Bug Fix]: Fix compatibility with Library Viewer Pro 2.0.1

2.0.1

  • [Bug Fix]: Fix bug of Library Viewer Pro. Files weren’t opened…

2.0.0

  • Tested up to WP 5.7
  • [Enhancement]: Add compatibility for symbols #, ? for file names and folder names of your library
  • [Enhancement]: Security update: Hidden folders (that have in their name the string ‘hidden-folder’) and hidden-files (that have in their name the string ‘hidden-ile’), now,
    are not accessible, if you know the full path of the hidden folder/file.
  • [Enhancement]: Now the file link is being encoded and then is appended to the my_doc_viewer parameter. If you don’t want to be encoded use lv_my_doc_viewer_file_encoded filter.
  • [Deprecated]: library-viewer--current-breadcrumb-item class removed from breadcrumb current item. Replaced with the CSS rule .library-viewer--breadcrumb-item:last-of-type
    Hooks:
  • [Deprecated]: LV__folder_was_viewed action replaced with lv_folder_was_viewed action.
  • [Deprecated]: LV__array_replace_to__in_foldernames filter replaced with lv_folder_fake_path_symbols filter.
  • [Deprecated]: LV__array_replace_from__in_foldernames filter replaced with lv_folder_real_path_symbols filter.
  • [Deprecated]: LV__array_replace_to__in_filenames filter replaced with lv_file_fake_path_symbols filter.
  • [Deprecated]: LV__array_replace_from__in_filenames filter replaced with lv_file_real_path_symbols filter.
  • [Deprecated]: LV__folder_html filter replaced with lv_folder_html filter.
  • [Deprecated]: LV__file_html filter replaced with lv_file_html filter.
  • [Deprecated]: LV__file_was_viewed filter replaced with lv_file_was_viewed filter.
  • [New]: lv_file_identifier filter introduced. With this you can change the ‘/LV/’ that is the part of URL of a file.
  • [New]: lv_before_breadcrumb_start action introduced.
  • [New]: lv_after_breadcrumb_start action introduced.
  • [New]: lv_breadcrumb_folder_delimiter_html action introduced. You can change the delimiter of folders of breadcrumb.
  • [New]: lv_breadcrumb_items action introduced. With this filter, you can alter the breadcrumb items, for example the folder name and folder fake link.
  • [New]: lv_before_breadcrumb_end action introduced.
  • [New]: lv_after_breadcrumb_end action introduced.
  • [New]: lv_empty_folder_html filter introduced. If the current folder contains neither files nor folders, an equivalent message will be displayed an with filter. With this filter you can change it.
  • [New]: lv_folder_text_at_beginning filter introduced. This filter allow us to add or change the text at beginning of the folder, i.e. the text before the first containing folder.
  • [New]: lv_containing_folders filter introduced. Containing folders of current folder filter.
  • [New]: lv_folder_icon_html filter introduced. Used to filter the html of folder icon.
  • [New]: lv_folder_html filter introduced. Used to filter the html output of printed folder.
  • [New]: lv_before_folder action introduced.
  • [New]: lv_after_folder action introduced.
  • [New]: lv_containing_files filter introduced. Containing files of current folder filter.
  • [New]: lv_file_icon_html filter introduced. Used to set a file icon using php.
  • [New]: lv_file_html filter introduced. Used to filter the html output of printed file.
  • [New]: lv_before_file action introduced.
  • [New]: lv_after_file action introduced.
  • [New]: lv_folder_text_at_end filter introduced. This filter allow us to add or change the text at end of the folder, i.e. the text after the last containing file.
  • [New]: lv_folder_was_viewed action introduced. Do some actions if a folder was accessed/viewed.
  • [New]: lv_file_was_viewed action introduced. Do some actions if a file was accessed/viewed.
  • [New]: Filter lv_my_doc_viewer_file_encoded introduced. With this filter you can determine if the file will be appended to my_doc_viewer as encoded or not default is true (encoded).
  • [New]: Filter lv_mime_types introduced. If you want to add support for mime types that are not included, use this filter.

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 έχει δοκιμαστεί μέχρι το WP 5.2.3
  • Το αρχείο readme μεταφράστηκε στα ελληνικά
  • Η συμβατότητα με το Visual Composer έχει δοκιμαστεί και λειτουργεί καλά
  • Οδηγίες για τη διόρθωση της διένεξης με το πρόσθετο Remove Uppercase Ascents προστέθηκαν στις συχνές ερωτήσεις
  • Κουμπιά επιστροφής έχουν προστεθεί στα μηνύματα σφάλματος

1.0.2

  • Το Library Viewer έχει δοκιμαστεί μέχρι το WP 5.2.2
  • Ο σύνδεσμος για το Library Viewer Pro έχει προστεθεί στην σελίδα των προσθέτων
  • Το URI του προσθέτου έχει διορθωθεί
  • Έχει προστεθεί ένα στιγμιότυπο οθόνης στην επίσημη σελίδα του Library Viewer στο αποθετήριο προσθέτων του WP
  • Μικρές τυπογραφικές διορθώσεις στο αρχείο readme και στην επίσημη σελίδα του Library Viewer στο αποθετήριο προσθέτων του WP

1.0.1

  • Συμβατότητα έχει προστεθεί για τους περισσότερους συνηθισμένους ειδικούς χαρακτήρες (+ , & , , . )
  • Redirect waiting time to login is now 5 seconds (if you want to change this you need to buy the Library Viewer Pro)
  • The ability of encryption of the real path of your folder (with hash technique) moved to Library Viewer Pro

1.0.0

  • Αρχική έκδοση.