From e4607f444594ce913f60c833ba9edc2e74aabe7f Mon Sep 17 00:00:00 2001 From: John Bintz Date: Mon, 9 Nov 2009 22:42:17 -0500 Subject: [PATCH 1/3] modify gitignore for eclipse --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index b25c15b..4b208c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ *~ +.buildpath +.project +.settings/ + From 92fd202c1dc54a75852f9473c30d6d84ad0d1182 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Mon, 9 Nov 2009 22:42:30 -0500 Subject: [PATCH 2/3] work around WP bug #11112 --- actions/comicpress_build-storyline-schema.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; From d2532dbf702aa00994f0c92ff3ec75da1e22ecbd Mon Sep 17 00:00:00 2001 From: John Bintz Date: Sat, 21 Nov 2009 15:47:58 -0500 Subject: [PATCH 3/3] Fix FS#135 --- comicpress_manager_library.php | 6 ++++-- test/ComicPressLibraryTest.php | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 test/ComicPressLibraryTest.php diff --git a/comicpress_manager_library.php b/comicpress_manager_library.php index 55e8202..7acbdad 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'); } } @@ -326,7 +328,7 @@ function cpm_read_comics_folder() { if ($glob_results === false) { //$cpm_config->messages[] = "FYI: glob({$cpm_config->path}/*) returned false. This can happen on some PHP installations if you have no files in your comic directory. This message will disappear once you upload a comic to your site."; - return array(); + return array(); } $filtered_glob_results = array(); @@ -789,4 +791,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)); + } +}