From c5500420e9d3200a3473b83ea8680408d7105f73 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Wed, 20 Jan 2010 06:14:28 -0500 Subject: [PATCH] add upload-path media option --- classes/ComicPressMediaHandling.inc | 3 +++ test/ComicPressMediaHandlingTest.php | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/classes/ComicPressMediaHandling.inc b/classes/ComicPressMediaHandling.inc index 9f24ab1..658ad83 100644 --- a/classes/ComicPressMediaHandling.inc +++ b/classes/ComicPressMediaHandling.inc @@ -96,6 +96,9 @@ class ComicPressMediaHandling { case 'type-folder': $value = $this->type_folder; break; + case 'upload-path': + $value = get_option('upload_path'); + break; default: if (preg_match('#^date-(.*)$#', $matches[1], $date_matches) > 0) { if (isset($this->post_to_use)) { diff --git a/test/ComicPressMediaHandlingTest.php b/test/ComicPressMediaHandlingTest.php index 899d550..5d56470 100644 --- a/test/ComicPressMediaHandlingTest.php +++ b/test/ComicPressMediaHandlingTest.php @@ -95,7 +95,8 @@ class ComicPressMediaHandlingTest extends PHPUnit_Framework_TestCase { array('%test test%', '%test test%'), array('%wordpress%/%type-folder%', vfsStream::url('root') . '/comic'), array('%date-Y%', '2009'), - array('%wordpress%/%type-folder%/%date-Y-m-d%*.*', vfsStream::url('root') . '/comic/2009-01-01.*\..*') + array('%wordpress%/%type-folder%/%date-Y-m-d%*.*', vfsStream::url('root') . '/comic/2009-01-01.*\..*'), + array('%wordpress%/%upload-path%/%type-folder%/%date-Y-m-d%*.*', vfsStream::url('root') . '/1/files/comic/2009-01-01.*\..*') ); } @@ -106,6 +107,8 @@ class ComicPressMediaHandlingTest extends PHPUnit_Framework_TestCase { $cpmh = $this->getMock('ComicPressMediaHandling', array('_abspath')); $cpmh->expects($this->any())->method('_abspath')->will($this->returnValue(vfsStream::url('root'))); + update_option('upload_path', '1/files'); + $this->assertEquals($expected_result, $cpmh->_expand_filter($filter, 'comic', (object)array('ID' => 1, 'post_date' => '2009-01-01 15:00:00'))); }