Property `globals`



The last parameter of almost all the hooks of Library Viewer is the global property of the current object.

Watch out!! The same hook maybe can be called in 2 different objects, as you can see below.
The solution to this is the $globals[‘current_viewer’] that you can use with conditional logic.

Library_Viewer_Pro_Shortcode::globals
/**
* All the useful variables that methods use,
* parameters are included.
*
* SOS: for each parameter that isn't passed to the shortcode,
* $globals keep its DEFAULT value, that is initialized
* in `init_globals_default_values` method,
* except these that is initialized as null and defined in `init_global_{$global}` method.
*
* @since 2.0.0
* @var array $globals{
* The globals variables.
*
* @type string $have_file_access The shortcode parameter `have_file_access`.
* @type string $my_doc_viewer The shortcode parameter `my_doc_viewer`.
* @type string $login_page The shortcode parameter `login_page`.
* @type string $path The shortcode parameter `path`.
* @type string $breadcrumb The shortcode parameter `breadcrumb`.
* @type string $url_suffix The shortcode parameter `url_suffix`.
* @type string|array $hidden_folders The shortcode parameter `hidden_folders`.
* @type string|array $hidden_files The shortcode parameter `hidden_files`.
* @type string|array $shown_folders The shortcode parameter `shown_folders`.
* @type string|array $shown_files The shortcode parameter `shown_files`.
* @type string $real_path The real path of current folder with a trailing slash.
* @type string $dir The link (fake link) of current folder without trailing slash.
* @type string $current_viewer The current viewer. Are you viewing a folder or a file?
* If you are viewing a folder, current_viewer is `folder`.
* If you are viewing a file, current_viewer is `file`.
* @type string $current_page_url Full current URL without get parameters, without trailing slash.
* @type string $file_identifier String that identifies if file will be loaded. Default is `LV`.
* @type string $root_identifier String that identifies if which is the root keyword that
* developer need to insert in path parameter to display the
* folders and files of the root directory. Default is `root`.
* @type array $folder_fake_path_symbols These symbols will replace the `$folder_real_path_symbols`,
* if the fake path of folder was called.
* @type array $folder_real_path_symbols These symbols will replace the `$folder_fake_path_symbols`,
* if the real path of folder will be asked.
* (real path is the relative path of the folder)
* @type array $file_fake_path_symbols These symbols will replace the `$file_real_path_symbols`,
* if the fake path of file was called.
* @type array $file_real_path_symbols These symbols will replace the `$file_fake_path_symbols`,
* if the real path of file will be asked.
* (real path is the relative path of the file)
* }
*/
Library_Viewer_Pro_File::globals
/**
* All the useful variables that methods use,
* parameters are included.
*
* SOS: for each parameter that isn't passed to the shortcode,
* $globals keep its DEFAULT value, that is initialized
* in `init_globals_default_values` method,
* except these that is initialized as null and defined in `init_global_{$global}` method.
*
* @since 2.0.0
* @var array $globals{
* The globals variables.
*
* @type string $have_file_access The shortcode parameter `have_file_access`.
* @type string $my_doc_viewer The shortcode parameter `my_doc_viewer`.
* @type string $login_page The shortcode parameter `login_page`.
* @type string $path The shortcode parameter `path`.
* @type string $url_suffix The shortcode parameter `url_suffix`.
* @type string|array $hidden_folders The shortcode parameter `hidden_folders`.
* @type string|array $hidden_files The shortcode parameter `hidden_files`.
* @type string|array $shown_folders The shortcode parameter `shown_folders`.
* @type string|array $shown_files The shortcode parameter `shown_files`.
* @type string $current_viewer The current viewer. Are you viewing a folder or a file?
* If you are viewing a folder, current_viewer is `folder`.
* If you are viewing a file, current_viewer is `file`.
* @type string $current_page_url Full current URL without get parameters, without trailing slash.
* @type string $file_identifier String that identifies if file will be loaded. Default is `LV`.
* @type string $root_identifier String that identifies if which is the root keyword that
* developer need to insert in path parameter to display the
* folders and files of the root directory. Default is `root`.
* @type array $folder_fake_path_symbols These symbols will replace the `$folder_real_path_symbols`,
* if the fake path of folder was called.
* @type array $folder_real_path_symbols These symbols will replace the `$folder_fake_path_symbols`,
* if the real path of folder will be asked.
* (real path is the relative path of the folder)
* @type array $file_fake_path_symbols These symbols will replace the `$file_real_path_symbols`,
* if the fake path of file was called.
* @type array $file_real_path_symbols These symbols will replace the `$file_fake_path_symbols`,
* if the real path of file will be asked.
* (real path is the relative path of the file)
* @type string $file_fake_link The link (fake link) of current file (the path after the /$file_identifier/).
* @type string $file_real_link The real (relative) link of current file.
* @type string $file_abs_path The absolute path of current file.
* @type string $file_name The name of the file, with the extension.
* @type string $file_extension The extension of the file.
* }
*/
Scroll to top