File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -125,7 +125,6 @@ function listFolderFiles($dir, $url = '') {
125125 $ output = '' ;
126126 foreach ($ ffs as $ ff ) {
127127 $ output .= '<li> ' ;
128-
129128 $ file_path = str_replace (ABSPATH , '' , $ dir );
130129 $ file_url = site_url ('/ ' ) . $ file_path . '/ ' . $ ff ;
131130 if (is_dir ($ dir . '/ ' . $ ff )) {
@@ -166,11 +165,17 @@ function showFileList($id) {
166165 if ($ file ) {
167166 mbstring_binary_safe_encoding ();
168167
169- //get the url
168+ $ site_url = site_url ('/ ' );
169+ $ parsed_site_url = parse_url ($ site_url );
170170 $ url = $ file ['url ' ];
171+ if ($ parsed_site_url ['scheme ' ] == 'https ' ) {
172+ $ url = str_replace ("http:// " , "https:// " , $ url );
173+ } else {
174+ $ url = str_replace ("https:// " , "http:// " , $ url );
175+ }
171176
172177 //Replace url to directory path
173- $ path = str_replace (site_url ( ' / ' ) , ABSPATH , esc_url ($ url ));
178+ $ path = str_replace ($ site_url , ABSPATH , esc_url ($ url ));
174179
175180 if (is_file ($ path )) {
176181 $ filesize = size_format (filesize ($ path ));
You can’t perform that action at this time.
0 commit comments