Fixes for IIS / windows for ComicPressMediaHandling.inc
Signed-off-by: Philip M. Hofer (Frumph) <frumph_dragon@yahoo.com>
This commit is contained in:
parent
7a25cca894
commit
2f96341d49
|
@ -66,7 +66,7 @@ class ComicPressMediaHandling {
|
||||||
|
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
function _abspath() {
|
function _abspath() {
|
||||||
return realpath(ABSPATH);
|
return trailingslashit($this->_resolve_regex_path(realpath(ABSPATH)));
|
||||||
}
|
}
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ class ComicPressMediaHandling {
|
||||||
$value = '';
|
$value = '';
|
||||||
switch (strtolower($matches[1])) {
|
switch (strtolower($matches[1])) {
|
||||||
case 'wordpress':
|
case 'wordpress':
|
||||||
$value = $this->_abspath();
|
$value = untrailingslashit($this->_abspath());
|
||||||
break;
|
break;
|
||||||
case 'type-folder':
|
case 'type-folder':
|
||||||
$value = $this->type_folder;
|
$value = $this->type_folder;
|
||||||
|
@ -93,14 +93,16 @@ class ComicPressMediaHandling {
|
||||||
}
|
}
|
||||||
|
|
||||||
function _read_directory($pattern) {
|
function _read_directory($pattern) {
|
||||||
$dirname = $this->_resolve_regex_path(dirname($pattern));
|
$resolved_pattern = $this->_resolve_regex_path($pattern);
|
||||||
|
$dirname = dirname($resolved_pattern);
|
||||||
$results = false;
|
$results = false;
|
||||||
if (is_dir($dirname)) {
|
if (is_dir($dirname)) {
|
||||||
$results = array();
|
$results = array();
|
||||||
if (($dh = opendir($dirname)) !== false) {
|
if (($dh = opendir($dirname)) !== false) {
|
||||||
$filename_pattern = str_replace('#', '\#', basename($pattern));
|
$filename_pattern = str_replace('#', '\#', basename($resolved_pattern));
|
||||||
while (($file = readdir($dh)) !== false) {
|
while (($file = readdir($dh)) !== false) {
|
||||||
$target = $dirname . '/' . $file;
|
$target = $dirname . '/' . $file;
|
||||||
|
// echo "<br />TARGET:<br />"; var_dump($target); echo "<br /><br />";
|
||||||
if (is_file($target)) {
|
if (is_file($target)) {
|
||||||
if (preg_match("#^${filename_pattern}$#", $file) > 0) {
|
if (preg_match("#^${filename_pattern}$#", $file) > 0) {
|
||||||
$results[] = $target;
|
$results[] = $target;
|
||||||
|
@ -167,6 +169,7 @@ class ComicPressMediaHandling {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the comic path.
|
* Get the comic path.
|
||||||
* @param string $type The type to retrieve.
|
* @param string $type The type to retrieve.
|
||||||
|
@ -190,17 +193,18 @@ class ComicPressMediaHandling {
|
||||||
|
|
||||||
if (isset($globals[$type])) {
|
if (isset($globals[$type])) {
|
||||||
$filter = $this->_expand_filter($filter, $globals[$type], $post_to_use);
|
$filter = $this->_expand_filter($filter, $globals[$type], $post_to_use);
|
||||||
|
// var_dump($filter);
|
||||||
if (is_array($results = $this->_read_directory($filter))) {
|
if (is_array($results = $this->_read_directory($filter))) {
|
||||||
if (($pre_handle = apply_filters('comicpress_pre_handle_comic_path_results', false, $results, $type, $post_to_use)) !== false) {
|
if (($pre_handle = apply_filters('comicpress_pre_handle_comic_path_results', false, $results, $type, $post_to_use)) !== false) {
|
||||||
return $pre_handle;
|
return $pre_handle;
|
||||||
}
|
}
|
||||||
|
// echo "<br />RESULTS: <br />";var_dump($results); echo "<br /><br />";
|
||||||
$new_results = array();
|
$new_results = array();
|
||||||
|
// echo "<br />ABSPATH: <br />"; var_dump($this->_abspath()); echo "<br /><br />";
|
||||||
foreach ($results as $result) {
|
foreach ($results as $result) {
|
||||||
$new_results[] = str_replace($this->_abspath(), '', $result);
|
$new_results[] = str_replace($this->_abspath(), '', $result);
|
||||||
}
|
}
|
||||||
|
// echo "<br />NEW RESULTS: <br />";var_dump($new_results); echo "<br /><br />";
|
||||||
if ($multi) {
|
if ($multi) {
|
||||||
return $new_results;
|
return $new_results;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue