diff --git a/classes/ComicPress.inc b/classes/ComicPress.inc index 72ac4eb..17ae07d 100644 --- a/classes/ComicPress.inc +++ b/classes/ComicPress.inc @@ -162,18 +162,23 @@ class ComicPress { } function normalize_active_backends() { + if (!is_array($this->comicpress_options['active_backends'])) { + $this->comicpress_options['active_backends'] = array(); + } + + $this->comicpress_options['active_backends'] = array_intersect($this->get_valid_backends(), $this->comicpress_options['active_backends']); + + return $this->comicpress_options['active_backends']; + } + + function get_valid_backends() { $available_backends = array(); foreach ($this->_get_declared_classes() as $class) { if (preg_match('#^ComicPressBackend(.*)Factory$#', $class, $matches) > 0) { $available_backends[] = $class; } } - - if (!is_array($this->comicpress_options['active_backends'])) { - $this->comicpress_options['active_backends'] = array(); - } - - $this->comicpress_options['active_backends'] = array_intersect($available_backends, $this->comicpress_options['active_backends']); + return $available_backends; } // @codeCoverageIgnoreStart diff --git a/classes/partials/options-admin.inc b/classes/partials/options-admin.inc index dd80b14..b4e0bf4 100644 --- a/classes/partials/options-admin.inc +++ b/classes/partials/options-admin.inc @@ -11,7 +11,6 @@

-
diff --git a/test/ComicPressTest.php b/test/ComicPressTest.php index 5f34cfb..c66f469 100644 --- a/test/ComicPressTest.php +++ b/test/ComicPressTest.php @@ -349,6 +349,9 @@ class ComicPressTest extends PHPUnit_Framework_TestCase { array( array('ComicPressBackendURLFactory'), array('ComicPressBackendURLFactory'), array('ComicPressBackendURLFactory') ), + array( + array(), false, array() + ), ); }