diff --git a/.gitignore b/.gitignore
index b25c15b..4b208c8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,5 @@
*~
+.buildpath
+.project
+.settings/
+
diff --git a/actions/comicpress_build-storyline-schema.php b/actions/comicpress_build-storyline-schema.php
index f2c7bf8..4002565 100644
--- a/actions/comicpress_build-storyline-schema.php
+++ b/actions/comicpress_build-storyline-schema.php
@@ -30,8 +30,9 @@ function cpm_action_build_storyline_schema() {
$parts = explode("/", $field);
if (($parts[0] == "0") && (count($parts) > 1)) {
$category_id = end($parts);
- $category = get_category($category_id, ARRAY_A);
+ $category = get_category($category_id);
if (!empty($category)) {
+ $category = (array)$category;
if ($category['cat_name'] != $value) {
$cpm_config->messages[] = sprintf(__('Category %1$s renamed to %2$s.', 'comicpress-manager'), $category['cat_name'], $value);
$category['cat_name'] = $value;
diff --git a/comicpress_manager_library.php b/comicpress_manager_library.php
index f5299cf..dfe8539 100644
--- a/comicpress_manager_library.php
+++ b/comicpress_manager_library.php
@@ -188,6 +188,8 @@ function cpm_breakdown_comic_filename($filename, $allow_override = false) {
$converted_title = ucwords(trim(preg_replace('/[\-\_]/', ' ', $title)));
$date = date($pattern, strtotime($date));
+ if (is_numeric($converted_title)) { $converted_title = "Title: ${converted_title}"; }
+
return compact('date', 'title', 'converted_title');
}
}
@@ -790,4 +792,4 @@ function cpm_short_size_string_to_bytes($string) {
return $max_bytes;
}
-?>
\ No newline at end of file
+?>
diff --git a/test/ComicPressLibraryTest.php b/test/ComicPressLibraryTest.php
new file mode 100644
index 0000000..db5ca1b
--- /dev/null
+++ b/test/ComicPressLibraryTest.php
@@ -0,0 +1,25 @@
+ '2009-01-01',
+ 'title' => '-1',
+ 'converted_title' => 'Title: 1'
+ ))
+ );
+ }
+
+ /**
+ * @dataProvider providerTestBreakdownComicFilename
+ */
+ function testBreakdownComicFilename($input, $expected_output) {
+ $this->assertEquals($expected_output, cpm_breakdown_comic_filename($input));
+ }
+}