Library Viewer

Description

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).

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 must buy the Library Viewer Pro.
You can buy Library Viewer Pro from this link: www.pexlechris.dev/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, or page etc.

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

1) have_file_access
2) my_doc_viewer
3) login_page

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,subsriber” : only administrators, authors and subsribers 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 in you browser or they are downloaded. “default” is the DEFAULT value.
  • 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=”https://shortzon.com/st?api=4b7cb109a40daf048fadf270cff37733daa3cf05&url=” : 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.

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.
    pdf, jpeg, jpg, png, gif, txt, mp3, mp4, avi and html files opens in new tab of browser, all others are downloaded (this from PC, from smartphone pdf files are downloaded).
    If you want support for others files (that browser can open), please contact me to add support and release an update of this plugin.
  • 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 text 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";
    ?>
    
  • This plugin creates a folder with name “library-viewer” in your WP uploads folder and adds .inc files in this folder that help plugin to work effectively.

Library Viewer Pro

  • Library Viewer Pro supports comments
  • With Library Viewer Pro you can display folders & files of a directory (in FTP) of your choice, not only library directory (yoursite.com/library)
  • In the Library Viewer Pro you can set the seconds of user is waiting the redirection as you like (0: for instant redirect).
    (With Library Viewer when user is required to login, he/she wait for 5 seconds to redirect in the login page.)
  • With Library Viewer Pro you can set the imgs of your choice for the folders in the front-end.
  • 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
    With Library Viewer Pro you can set the character of your choice to replace the spaces in the urls.
  • The algorithm of Library Viewer does not show in the front-end folders with name that contains in their name the string “hidden-folder”.
    Also does not show .php and .ini files and the files with name that contains in their name the string “hidden-file”.
    With Library Viewer Pro you can set the names that you don’t want to displaying in the front-end.
  • With Library Viewer Pro you can encrypt the real path of your folder.
    For example, if you set the real library path this: yoursite.com/library505/ , you can force your users see this path: yoursite.com/page_that_shortcode_is_placed/?dir=library/folder1
    THE HASH (505) IS NOT VISIBLE FROM THE USERS, SO THEY WILL NOT KNOW THE REAL PATH OF FOLDERS & FILES!
  • Buy Library Viewer Pro in this link: www.pexlechris.dev/library-viewer-pro

Screenshots

  • library folder must be located in the root of your FTP server
  • Not all files and folders are displaying in the front-end Library Viewer because of their special names (hidden-folder, hidden-file, .php etc.)
  • The string-value of the $text_at_beginning variable is displayed between the breadcrumb and the folders, the string-value of the $text_at_end variable is displayed below the folders & files.

Installation

  1. Download the plugin from Official WP Plugin Repository
  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.

FAQ

Are there shortcode examples?
  • Case 1 :

        [library-viewer]
    

    In this case, the shortcode prints all the containing folders and files and anyone (logged in or not) can click and see the files.

  • Case 2 :

        [library-viewer have_file_access="all"]
    

    In this case, the shortcode prints all the containing folders and files and anyone (logged in or not) can click and see the files.
    have_file_access=”all” allows opening the files from anyone (logged in or not visitors of your site)

  • Case 3 :

        [library-viewer have_file_access="administrator" login_page="login"]
    

    In this case, the shortcode prints all the containing folders and files and if user is not logged in, he/she will be redirected to this URL: yoursite.com/login to login.
    If user is not administrator, after login will see an error message that tells to user that tells the user that hasn’t the previleges to see this file.
    If user is administrator, after login the file will open with the plugin viewer from PC/laptop (downloaded from smartphone).

  • Case 4 :

        [library-viewer have_file_access="administrator,editor" my_doc_viewer="https://docs.google.com/viewerng/viewer?url="]
    

    In this case, the shortcode prints all the containing folders and files and if user is not logged in, he/she will be redirected to this URL: yoursite.com/wp-login to login.
    If user is not administrator or editor, after login, will see an error message that tells the user that hasn’t the previleges to see this file.
    If user is administrator or editor, after login, the file will open in the plugin viewer from PC/laptop and will be downloaded from smartphone.
    my_doc_viewer does nothing here!

  • Case 5 :

        [library-viewer have_file_access="logged_in"]
    

    In this case, the shortcode prints all the containing folders and files and if user is not logged in, he/she will be redirected to this URL: yoursite.com/wp-login to login.
    After login (regardless of the role of the user), the file will open in the plugin viewer from PC/laptop and will be downloaded from smartphone.

  • Case 6 :

        [library-viewer my_doc_viewer="https://docs.google.com/viewerng/viewer?url=" login_page="login"]
    

    In this case, the shortcode prints all the containing folders and files and when user(logged in or not visitors of your site) clicks on file will be redirected
    in https://docs.google.com/viewerng/viewer?url=http://yoursite.com/library/yourfile.pdf , in the Google Doc Viewer, that is!
    login_page parameter does nothing, because user is not required to login before saw the file.

  • Case 7 :

        [library-viewer have_file_access="all" my_doc_viewer="https://docs.google.com/viewerng/viewer?url="]
    

    In this case, the shortcode prints all the containing folders and files and when user(logged in or not visitors of your site) clicks on file will be redirected
    in https://docs.google.com/viewerng/viewer?url=http://yoursite.com/library/yourfile.pdf , in the Google Doc Viewer, that is!
    have_file_access=”all” allows opening the files from anyone (logged in or not) and from your doc viewer of your choice, with Google Doc Viewer in this example.

The plugin says me that a folder or a file doesn’t exists, but it exists! Why?

This is because some special characters(e.g. #) are not supported as names of folders or files.
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;}

With which Page Builders the Library Viewer are compatible?

Library Viewer have been tested with TinyMCE (Classic Editor) , Gutenberg , WPBakery, Visual Composer and works fine!

Can I change the colors or the fonts that plugin uses?

Yes. But only with plain CSS at the moment. So you can add your custom css from WP customizer (from Additional CSS)

When a comment is added under a folder-page, this comment is displayed in another folder-page too. Why?

This happens because Library Viewer is not support comments. So if you want to displaying different comments in different folders/pages you need to buy Library Viewer Pro!

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

Yes. Please read carefully the section “Other Details” of plugin.

Can I add my custom text inside a folder of front-end library viewer?

Yes. Please read carefully the section “Other Detals” of plugin.

How to upload files and create new folders?

You can do this via FTP or from the File Manager of your cPanel/Plesk etc

I found in my uploads folder, a folder “library viewer” and an .inc file. Are these from your plugin?

Yes. Library Viewer uses this file to be able to work effectively. If you delete it, the next time that library will be loaded it will be created again!
This is instead of writing in a database, because the informations that plugin need to save are only 2-3 strings!

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

Reviews

September 13, 2019
Very good plugin, it works as expected. Also, it has great and fast support!
Read all 1 review

Contributors & Developers

“Library Viewer” is open source software. The following people have contributed to this plugin.

Contributors

Translate “Library Viewer” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

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 must 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

  • Initial Release.