add support for filters from options
This commit is contained in:
parent
85c46dbc3a
commit
9a3dba75dc
|
@ -30,6 +30,10 @@ class ComicPressMediaHandling {
|
|||
if (isset($comic_filename_filters[$filter_to_use])) {
|
||||
return $this->_convert_to_percent_filter($comic_filename_filters[$filter_to_use]);
|
||||
}
|
||||
$options = get_option('comicpress_options');
|
||||
if (isset($options['comic_filename_filters'][$filter_to_use])) {
|
||||
return $this->_convert_to_percent_filter($options['comic_filename_filters'][$filter_to_use]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,8 @@ class ComicPressMediaHandlingTest extends PHPUnit_Framework_TestCase {
|
|||
array(null, $default),
|
||||
array('fail', $default),
|
||||
array(array(), $default),
|
||||
array('test', 'test')
|
||||
array('test', 'test'),
|
||||
array('test-from-option', 'test-from-option'),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -53,6 +54,12 @@ class ComicPressMediaHandlingTest extends PHPUnit_Framework_TestCase {
|
|||
|
||||
$comic_filename_filters['test'] = 'test';
|
||||
|
||||
update_option('comicpress_options', array(
|
||||
'comic_filename_filters' => array(
|
||||
'test-from-option' => 'test-from-option'
|
||||
)
|
||||
));
|
||||
|
||||
$default = str_replace('{date}', $this->cpmh->default_filename_filter, $this->cpmh->default_filter);
|
||||
|
||||
$cpmh = $this->getMock('ComicPressMediaHandling', array('_convert_to_percent_filter'));
|
||||
|
|
Loading…
Reference in New Issue