diff --git a/test/widgets/GraphicalNavigationWidgetTest.php b/test/widgets/GraphicalNavigationWidgetTest.php index 5a856d5..d43d9fa 100644 --- a/test/widgets/GraphicalNavigationWidgetTest.php +++ b/test/widgets/GraphicalNavigationWidgetTest.php @@ -98,7 +98,7 @@ class GraphicalNavigationWidgetTest extends PHPUnit_Framework_TestCase { $w->expects($this->once())->method('_new_comicpress_storyline')->will($this->returnValue($this->getMock('Storyline', array('set_order_via_flattened_storyline')))); $w->expects($this->once())->method('_new_comicpress_navigation')->will($this->returnValue($this->getMock('Navigation', array('init', 'get_post_nav')))); - $this->assertEquals('test', $w->set_up_post_nav(array())); + $this->assertEquals('test', array_shift($w->set_up_post_nav(array()))); } function providerTestSetUpPostNavStoryPrev() { @@ -130,7 +130,7 @@ class GraphicalNavigationWidgetTest extends PHPUnit_Framework_TestCase { * @dataProvider providerTestSetUpPostNavStoryPrev */ function testComicPressSetUpPostNavFilterStoryPrev($instance, $post_nav, $expected_post_nav) { - $this->assertEquals($expected_post_nav, array_shift($this->w->_comicpress_set_up_post_nav_story_prev($post_nav, null, $instance))); + $this->assertEquals($expected_post_nav, array_shift($this->w->_comicpress_set_up_post_nav_story_prev(array($post_nav, null, $instance)))); } function providerTestComicPressSetUpPostNavFilterMultiPageSupport() { @@ -205,7 +205,7 @@ class GraphicalNavigationWidgetTest extends PHPUnit_Framework_TestCase { $page = $_page; $numpages = $_numpages; - $this->assertEquals($expected_post_nav, array_shift($this->w->_comicpress_set_up_post_nav_multi_page_support($post_nav, $post, $instance))); + $this->assertEquals($expected_post_nav, array_shift($this->w->_comicpress_set_up_post_nav_multi_page_support(array($post_nav, $post, $instance)))); } function providerTestBuildInPostPageLink() { diff --git a/widgets/GraphicalNavigationWidget.inc b/widgets/GraphicalNavigationWidget.inc index 5343527..e081feb 100644 --- a/widgets/GraphicalNavigationWidget.inc +++ b/widgets/GraphicalNavigationWidget.inc @@ -309,9 +309,9 @@ class GraphicalNavigationWidget extends WP_Widget { $navigation->init($storyline); $post_nav = $navigation->get_post_nav($post); - $result = apply_filters('comicpress_set_up_post_nav', $post_nav, $post, $instance); + $result = apply_filters('comicpress_set_up_post_nav', array($post_nav, $post, $instance)); if (is_array($result)) { - return array_shift(array_shift($result)); + return array_shift($result); } else { return $post_nav; } @@ -325,7 +325,8 @@ class GraphicalNavigationWidget extends WP_Widget { } } - function _comicpress_set_up_post_nav_story_prev($post_nav, $post, $instance) { + function _comicpress_set_up_post_nav_story_prev($info) { + list($post_nav, $post, $instance) = $info; if ($instance['story_prev_acts_as_prev_in'] == 'on') { if ($post_nav['storyline-previous'] !== false) { $post_nav['storyline-chapter-previous'] = $post_nav['storyline-previous']; @@ -334,8 +335,9 @@ class GraphicalNavigationWidget extends WP_Widget { return array($post_nav, $post, $instance); } - function _comicpress_set_up_post_nav_multi_page_support($post_nav, $post, $instance) { + function _comicpress_set_up_post_nav_multi_page_support($info) { global $page, $numpages; + list($post_nav, $post, $instance) = $info; if ($instance['enable_multipage_support'] == 'on') { if ($page < $numpages && $numpages != 1) { @@ -371,7 +373,7 @@ class GraphicalNavigationWidget extends WP_Widget { 'first', 'story_prev', 'story_next', 'story_prev_in', 'story_next_in', 'previous', 'random', 'archives', 'comments', 'next', 'last', 'buyprint', 'comictitle', 'lastgohome', - 'story_prev_acts_as_prev_in' + 'story_prev_acts_as_prev_in', 'enable_multipage_support' ); foreach ($all_fields as $field) { @@ -403,7 +405,8 @@ class GraphicalNavigationWidget extends WP_Widget { 'buyprint' => 'off', 'comictitle' => 'off', 'lastgohome' => 'off', - 'story_prev_acts_as_prev_in' => 'on' + 'story_prev_acts_as_prev_in' => 'on', + 'enable_multipage_support' => 'off', ); $title_defaults = array( @@ -436,7 +439,8 @@ class GraphicalNavigationWidget extends WP_Widget { 'archives' => __('Archives', 'comicpress'), 'comments' => __('Comments', 'comicpress'), 'random' => __('Random', 'comicpress'), - 'buyprint' => __('Buy Print', 'comicpress') + 'buyprint' => __('Buy Print', 'comicpress'), + 'enable_multipage_support' => __('Enable multi-page support', 'comicpress'), ) as $field => $label) { $title_field = "${field}_title"; ?>
@@ -479,6 +483,15 @@ class GraphicalNavigationWidget extends WP_Widget {
+
+

+ + + +

+
+
+

+ + + +