From 3b81ca9ae9473cefb1cdb9f1bcd855ce0b258bb0 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Fri, 20 Nov 2009 00:02:23 -0500 Subject: [PATCH] factor out dual author columns --- blog.php | 30 +++--------------------- index.php | 30 +++--------------------- partials/dual-columns.inc | 25 ++++++++++++++++++++ test/widgets/GraphicalNavigationTest.php | 4 ++-- widgets/graphical-navigation.php | 6 ++++- 5 files changed, 38 insertions(+), 57 deletions(-) create mode 100644 partials/dual-columns.inc diff --git a/blog.php b/blog.php index db2896d..fb6693a 100644 --- a/blog.php +++ b/blog.php @@ -21,33 +21,9 @@ Template Name: Blog } comicpress_pagination(); - } else { ?> -
-
-
- - View all posts by:
-
-
-
- - View all posts by:
-
-
-
- + } else { + include('partials/dual-columns.inc'); + } ?> diff --git a/index.php b/index.php index 846aeef..e465eb8 100644 --- a/index.php +++ b/index.php @@ -91,33 +91,9 @@ if ($disable_comic_frontpage != 'yes' && $disable_comic_blog_frontpage != 'yes'
-
-
-
- - View all posts by:
-
-
-
- - View all posts by:
-
-
-
- diff --git a/partials/dual-columns.inc b/partials/dual-columns.inc new file mode 100644 index 0000000..eb44acc --- /dev/null +++ b/partials/dual-columns.inc @@ -0,0 +1,25 @@ +
+
+
+ + View all posts by:
+
+
+
+ + View all posts by:
+
+
+
diff --git a/test/widgets/GraphicalNavigationTest.php b/test/widgets/GraphicalNavigationTest.php index c59134b..d3fb4a0 100644 --- a/test/widgets/GraphicalNavigationTest.php +++ b/test/widgets/GraphicalNavigationTest.php @@ -79,11 +79,11 @@ class GraphicalNavigationTest extends PHPUnit_Framework_TestCase { * @covers WidgetComicPressGraphicalStorylineNavigation::_group_navigation_buttons */ function testGroupNavigationButtons($buttons, $expected_grouping) { - _set_filter_expectation('comicpress_navigation_grouping_details', array( + _set_filter_expectation('comicpress_navigation_grouping_details', array(array( 'left' => array('one', 'two', 'three'), 'center' => true, 'right' => array('four', 'five', 'six'), - )); + ))); $this->assertEquals($expected_grouping, $this->w->_group_navigation_buttons($buttons, array())); } diff --git a/widgets/graphical-navigation.php b/widgets/graphical-navigation.php index 4b05495..65985de 100644 --- a/widgets/graphical-navigation.php +++ b/widgets/graphical-navigation.php @@ -179,11 +179,15 @@ class WidgetComicPressGraphicalStorylineNavigation extends WP_Widget { $grouping_hash = array(); $default_group = null; + var_dump(apply_filters('comicpress_navigation_grouping_details', array())); foreach (apply_filters('comicpress_navigation_grouping_details', array()) as $group => $members) { + var_dump($members); if ($members === true) { $default_group = $group; } else { - foreach ($members as $member) { $grouping_hash[$member] = $group; } + if (is_array($members)) { + foreach ($members as $member) { $grouping_hash[$member] = $group; } + } } }