diff --git a/classes/ComicPressMediaHandling.inc b/classes/ComicPressMediaHandling.inc index 28dbe4c..8d9e2ad 100644 --- a/classes/ComicPressMediaHandling.inc +++ b/classes/ComicPressMediaHandling.inc @@ -58,6 +58,15 @@ class ComicPressMediaHandling { return $result; } + function _get_regex_dirname($input) { + return dirname($this->_resolve_regex_path($input)); + } + + function _get_regex_filename($input) { + $input = preg_replace('#\\\(?![.])#', '/', $input); + return basename($input); + } + function _resolve_regex_path($input) { $input = str_replace('\.', '.', $input); $input = str_replace('\\', '/', $input); @@ -66,7 +75,7 @@ class ComicPressMediaHandling { // @codeCoverageIgnoreStart function _abspath() { - return realpath(ABSPATH); + return trailingslashit($this->_resolve_regex_path(realpath(ABSPATH))); } // @codeCoverageIgnoreEnd @@ -74,7 +83,7 @@ class ComicPressMediaHandling { $value = ''; switch (strtolower($matches[1])) { case 'wordpress': - $value = $this->_abspath(); + $value = untrailingslashit($this->_abspath()); break; case 'type-folder': $value = $this->type_folder; @@ -93,12 +102,12 @@ class ComicPressMediaHandling { } function _read_directory($pattern) { - $dirname = $this->_resolve_regex_path(dirname($pattern)); + $dirname = $this->_get_regex_dirname($pattern); $results = false; if (is_dir($dirname)) { $results = array(); if (($dh = opendir($dirname)) !== false) { - $filename_pattern = str_replace('#', '\#', basename($pattern)); + $filename_pattern = str_replace('#', '\#', $this->_get_regex_filename($pattern)); while (($file = readdir($dh)) !== false) { $target = $dirname . '/' . $file; if (is_file($target)) { @@ -167,6 +176,7 @@ class ComicPressMediaHandling { return false; } + /** * Get the comic path. * @param string $type The type to retrieve. @@ -190,17 +200,14 @@ class ComicPressMediaHandling { if (isset($globals[$type])) { $filter = $this->_expand_filter($filter, $globals[$type], $post_to_use); - 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) { return $pre_handle; } - $new_results = array(); foreach ($results as $result) { $new_results[] = str_replace($this->_abspath(), '', $result); } - if ($multi) { return $new_results; } else { @@ -211,3 +218,4 @@ class ComicPressMediaHandling { return false; } } + diff --git a/comments.php b/comments.php index 97b0daf..dbbd88c 100644 --- a/comments.php +++ b/comments.php @@ -16,24 +16,45 @@ if ( post_password_required() ) { ?> - +

- +
    - 'comment', - 'reply_text' => __('Reply to %s¬','comicpress'), - 'callback' => 'comicpress_comments_callback', - 'end-callback' => 'comicpress_comments_end_callback', - 'avatar_size'=>64 - ) - ); - } else { - wp_list_comments(array('type' => 'comment', 'avatar_size'=>64)); + 'comment', + 'reply_text' => __('Reply to %s¬','comicpress'), + 'callback' => 'comicpress_comments_callback', + 'end-callback' => 'comicpress_comments_end_callback', + 'avatar_size'=>64 + ) + ); + } else { + wp_list_comments(array('type' => 'comment', 'avatar_size'=>64)); }?>
+ + +
+

+
    + +
+
+ + @@ -110,26 +131,7 @@ if ( post_password_required() ) { ?> - - -

-
    - -
- +
\ No newline at end of file diff --git a/functions/displayblogpost.php b/functions/displayblogpost.php index 47f6cc6..d228122 100644 --- a/functions/displayblogpost.php +++ b/functions/displayblogpost.php @@ -64,7 +64,7 @@ function display_blog_post() { comment_status) { - if (comicpress_check_child_file('partials/commentlink') == false) { ?> + if (comicpress_check_child_file('partials/commentlink') == false && !(is_single())) { ?> comment_status) { + if ('open' == $post->comment_status && !$comicpress_options['static_blog'] && !(is_single())) { if (comicpress_check_child_file('partials/commentlink') == false) { ?> /> - + diff --git a/style.css b/style.css index 242b95f..617fdb0 100644 --- a/style.css +++ b/style.css @@ -631,13 +631,6 @@ h3, h3 a { margin-left: 45px; } - .pingback .comment-content { - margin-left: 0; - } - - .trackback .comment-content { - margin-left: 0; - } .comment-author cite { font-weight: bold; @@ -684,7 +677,6 @@ h3, h3 a { } .commentsrsslink { - float: right; font-size: 11px; } @@ -722,11 +714,27 @@ ul.children { list-style: none; } -.reply { - padding: 10px 0 0 0; - text-align: right; +#respond { + padding: 20px 0 0 0; } +/* Pingbacks and Trackbacks */ + +#pingtrackback { + font-size: 16px; +} + +.pingback .comment-content, .trackback .comment-content { + margin-left: 0; +} + +.trackback .comment-author cite, .pingback .comment-author cite { + font-weight: bold; + font-style: normal; + font-size: 13px; +} + + /* ARCHIVE */ /* For the built-in WordPress archive pages (by month or category) as well as search result pages */ @@ -1096,11 +1104,6 @@ ul.children { overflow: hidden; } -/* Pingbacks and Trackbacks */ - -li.pingback div p, li.trackback div p { - margin-left: 0; -} /* STORYLINES */ diff --git a/test/ComicPressMediaHandlingTest.php b/test/ComicPressMediaHandlingTest.php index 8e8f3fe..528a5e8 100644 --- a/test/ComicPressMediaHandlingTest.php +++ b/test/ComicPressMediaHandlingTest.php @@ -160,6 +160,35 @@ class ComicPressMediaHandlingTest extends PHPUnit_Framework_TestCase { $this->assertEquals($expected_output, $this->cpmh->_resolve_regex_path($input)); } + function providerTestGetRegexDirname() { + return array( + array('/test/test2', '/test') + ); + } + + /** + * @dataProvider providerTestGetRegexDirname + */ + function testGetRegexDirname($input, $expected_output) { + $this->assertEquals($expected_output, $this->cpmh->_get_regex_dirname($input)); + } + + function providerTestGetRegexFilename() { + return array( + array('/test/test2', 'test2'), + array('c:\test\test2', 'test2'), + array('/test/test2\.cat', 'test2\.cat'), + array('c:\test\test2\.cat', 'test2\.cat'), + ); + } + + /** + * @dataProvider providerTestGetRegexFilename + */ + function testGetRegexFilename($input, $expected_output) { + $this->assertEquals($expected_output, $this->cpmh->_get_regex_filename($input)); + } + function providerTestPreHandleComicPathResults() { return array( array('', '', false),