| Server IP : 151.101.66.159 / Your IP : 216.73.216.66 Web Server : Flywheel/5.1.0 System : Linux wordpress 6.12.113+ #1 SMP Thu Oct 22 02:38:20 UTC 2026 x86_64 User : root ( ) PHP Version : 7.4.33.18 Disable Function : disk_free_space,diskfreespace,dl,exec,fpassthru,getmypid,getmyuid,highlight_file,link,opcache_compile_file,opcache_get_configuration,opcache_is_script_cached,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifcontinued,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,phpinfo,popen,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,socket_listen,source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wp-content/plugins/file-manager-advanced/application/ |
Upload File : |
<?php
/**
* elFinder connector helpers (admin + frontend blocks).
*
* Restored for backward compatibility when Pro is not upgraded alongside Free.
*
* @package File_Manager_Advanced
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! function_exists( 'fma_resolve_local_volume_url' ) ) {
/**
* Resolve the public URL for the local filesystem volume (AFM-906).
*
* Prefer an explicit Files URL only when it is safe. When the File Manager
* root sits above the WordPress install (common on InstaWP: public_html root
* while WP lives under /i/), return an empty URL so elFinder streams files
* through the connector instead of building broken /{subdir}/wp-content links.
*
* @param array $settings Plugin fmaoptions.
* @param string $path Absolute filesystem root for the volume.
* @return string Trailing-slash URL, or empty to force connector streaming.
*/
function fma_resolve_local_volume_url( $settings, $path = '' ) {
$settings = is_array( $settings ) ? $settings : array();
if ( isset( $settings['hide_path'] ) && (string) $settings['hide_path'] === '1' ) {
return '';
}
$path = wp_normalize_path( ! empty( $path ) ? $path : ABSPATH );
$abspath = wp_normalize_path( untrailingslashit( ABSPATH ) );
$content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
$home_url = trailingslashit( home_url( '/' ) );
$site_url = trailingslashit( site_url( '/' ) );
$root_above_wp = ( $path !== $abspath && strpos( $abspath, trailingslashit( $path ) ) === 0 );
// Explicit Files URL — ignore defaults that simply copy home/site URL when root is above WP.
if ( ! empty( $settings['public_url'] ) ) {
$configured = trailingslashit( esc_url_raw( $settings['public_url'] ) );
$is_default_wp_url = ( $configured === $home_url || $configured === $site_url );
if ( ! ( $root_above_wp && $is_default_wp_url ) ) {
return $configured;
}
}
// Root is the web docroot / parent of WP → connector streaming avoids /i/wp-content 404s.
if ( $root_above_wp ) {
return '';
}
if ( $path === $content_dir || strpos( $path, $content_dir . '/' ) === 0 ) {
$relative = ltrim( substr( $path, strlen( $content_dir ) ), '/' );
return trailingslashit( content_url( $relative ) );
}
if ( $path === $abspath || strpos( $path, $abspath . '/' ) === 0 ) {
$relative = ltrim( substr( $path, strlen( $abspath ) ), '/' );
return trailingslashit( home_url( '/' . $relative ) );
}
// Unknown root outside WP — safer to stream via connector than guess a public URL.
return '';
}
}
if ( ! function_exists( 'fma_create_elfinder_connector' ) ) {
/**
* Create a stream-safe elFinder connector instance.
*
* @param elFinder $elfinder Configured elFinder instance.
* @return elFinderConnector|fma_elFinderConnector
*/
function fma_create_elfinder_connector( $elfinder ) {
if ( ! class_exists( 'elFinderConnector' ) ) {
$autoload = defined( 'FMAFILEPATH' )
? FMAFILEPATH . 'application/library/php/autoload.php'
: WP_PLUGIN_DIR . '/file-manager-advanced/application/library/php/autoload.php';
if ( file_exists( $autoload ) ) {
require_once $autoload;
}
}
if ( ! class_exists( 'fma_elFinderConnector' ) ) {
$connector_file = defined( 'FMAFILEPATH' )
? FMAFILEPATH . 'application/class_fma_elfinder_connector.php'
: WP_PLUGIN_DIR . '/file-manager-advanced/application/class_fma_elfinder_connector.php';
if ( file_exists( $connector_file ) && class_exists( 'elFinderConnector' ) ) {
require_once $connector_file;
}
}
if ( class_exists( 'fma_elFinderConnector' ) ) {
return new fma_elFinderConnector( $elfinder );
}
return new elFinderConnector( $elfinder );
}
}