inplements GH#23

This commit is contained in:
John Bintz 2009-12-25 13:38:56 -05:00
parent 3153800485
commit 4f4c0e8810
4 changed files with 10 additions and 29 deletions

View File

@ -2,12 +2,12 @@
require_once('PHPUnit/Framework.php'); require_once('PHPUnit/Framework.php');
require_once('MockPress/mockpress.php'); require_once('MockPress/mockpress.php');
require_once(dirname(__FILE__) . '/../../widgets/BuyThisPrintWidget.inc'); require_once(dirname(__FILE__) . '/../../widgets/BuyPrintWidget.inc');
class BuyThisPrintWidgetTest extends PHPUnit_Framework_TestCase { class BuyThisPrintWidgetTest extends PHPUnit_Framework_TestCase {
function setUp() { function setUp() {
_reset_wp(); _reset_wp();
$this->w = new BuyThisPrintWidget('id', 'name', array()); $this->w = new ComicPressBuyPrintWidget('id', 'name', array());
} }
function providerTestUpdate() { function providerTestUpdate() {

View File

@ -7,7 +7,7 @@ require_once(dirname(__FILE__) . '/../../widgets/CalendarWidget.inc');
class CalendarWidgetTest extends PHPUnit_Framework_TestCase { class CalendarWidgetTest extends PHPUnit_Framework_TestCase {
function setUp() { function setUp() {
_reset_wp(); _reset_wp();
$this->w = new CalendarWidget('id', 'name', array()); $this->w = new ComicPressCalendarWidget('id', 'name', array());
} }
function providerTestUpdate() { function providerTestUpdate() {

View File

@ -7,7 +7,7 @@ require_once(dirname(__FILE__) . '/../../widgets/GraphicalNavigationWidget.inc')
class GraphicalNavigationWidgetTest extends PHPUnit_Framework_TestCase { class GraphicalNavigationWidgetTest extends PHPUnit_Framework_TestCase {
function setUp() { function setUp() {
_reset_wp(); _reset_wp();
$this->w = new GraphicalNavigationWidget(); $this->w = new ComicPressGraphicalNavigationWidget();
} }
function testUpdateWidget() { function testUpdateWidget() {
@ -120,7 +120,7 @@ class GraphicalNavigationWidgetTest extends PHPUnit_Framework_TestCase {
$post = 'post'; $post = 'post';
$css = $this->getMock('GraphicalNavigationWidget', array('_new_comicpress_storyline', '_new_comicpress_navigation')); $css = $this->getMock('ComicPressGraphicalNavigationWidget', array('_new_comicpress_storyline', '_new_comicpress_navigation'));
update_option('comicpress-storyline-category-order', 'test'); update_option('comicpress-storyline-category-order', 'test');

View File

@ -11,7 +11,7 @@ Author URI: http://frumph.net/
require_once(dirname(__FILE__) . '/../classes/ComicPressNavigation.inc'); require_once(dirname(__FILE__) . '/../classes/ComicPressNavigation.inc');
class ComicPressGraphicalNavigationWidget extends WP_Widget { class ComicPressGraphicalNavigationWidget extends WP_Widget {
function ComicPressGraphicalNavigationWidget($skip_widget_init = false) { function ComicPressGraphicalNavigationWidget($skip_widget_init = false) {
if (!$skip_widget_init) { if (!$skip_widget_init) {
$widget_ops = array('classname' => __CLASS__, 'description' => __('Displays Graphical Navigation Buttons. (used in comic sidebars)','comicpress') ); $widget_ops = array('classname' => __CLASS__, 'description' => __('Displays Graphical Navigation Buttons. (used in comic sidebars)','comicpress') );
@ -303,10 +303,8 @@ class ComicPressGraphicalNavigationWidget extends WP_Widget {
} }
function comicpress_set_up_post_nav($post_nav, $instance) { function comicpress_set_up_post_nav($post_nav, $instance) {
if ($instance['story_prev_acts_as_prev_in'] == 'on') { if ($post_nav['storyline-previous'] !== false) {
if ($post_nav['storyline-previous'] !== false) { $post_nav['storyline-chapter-previous'] = $post_nav['storyline-previous'];
$post_nav['storyline-chapter-previous'] = $post_nav['storyline-previous'];
}
} }
return array($post_nav, $instance); return array($post_nav, $instance);
} }
@ -322,8 +320,7 @@ class ComicPressGraphicalNavigationWidget extends WP_Widget {
$all_fields = array( $all_fields = array(
'first', 'story_prev', 'story_next', 'story_prev_in', 'first', 'story_prev', 'story_next', 'story_prev_in',
'story_next_in', 'previous', 'random', 'archives', 'story_next_in', 'previous', 'random', 'archives',
'comments', 'next', 'last', 'buyprint', 'comictitle', 'lastgohome', 'comments', 'next', 'last', 'buyprint', 'comictitle', 'lastgohome'
'story_prev_acts_as_prev_in'
); );
foreach ($all_fields as $field) { foreach ($all_fields as $field) {
@ -354,8 +351,7 @@ class ComicPressGraphicalNavigationWidget extends WP_Widget {
'archive_path' => '', 'archive_path' => '',
'buyprint' => 'off', 'buyprint' => 'off',
'comictitle' => 'off', 'comictitle' => 'off',
'lastgohome' => 'off', 'lastgohome' => 'off'
'story_prev_acts_as_prev_in' => 'on'
); );
$title_defaults = array( $title_defaults = array(
@ -431,21 +427,6 @@ class ComicPressGraphicalNavigationWidget extends WP_Widget {
</label> </label>
</div> </div>
<?php break; <?php break;
case "story_prev": ?>
<div>
<label>
<input id="<?php echo $this->get_field_id('story_prev_acts_as_prev_in'); ?>"
name="<?php echo $this->get_field_name('story_prev_acts_as_prev_in'); ?>"
type="checkbox" class="comicpress-field" value="yes"<?php if ($instance['story_prev_acts_as_prev_in'] == "on") { echo ' checked="checked"'; } ?> />
<strong><?php _e('Enable go to start of chapter category.', 'comicpress'); ?></strong>
<p>
<em>
<?php _e('If the current post is not at the start of a chapter, the button will bring you back to the beginning of the chapter before going to a previous chapter.', 'comicpress') ?>
</em>
</p>
</label>
</div>
<?php break;
} }
?> ?>
</div> </div>