make backend generate from id work staticly
This commit is contained in:
parent
722c495f0c
commit
eb5d2c945f
|
@ -77,8 +77,8 @@ class ComicPressBackendAttachment extends ComicPressBackend {
|
|||
}
|
||||
|
||||
function generate_from_id($id) {
|
||||
if (strpos($id, $this->root_id . '-') === 0) {
|
||||
$id = str_replace($this->root_id . '-', '', $id);
|
||||
if (strpos($id, 'attachment-') === 0) {
|
||||
$id = str_replace('attachment-', '', $id);
|
||||
if (is_numeric($id)) {
|
||||
$post = get_post($id);
|
||||
if (!empty($post)) {
|
||||
|
|
|
@ -98,7 +98,7 @@ class ComicPressBackendAttachmentTest extends PHPUnit_Framework_TestCase {
|
|||
$return = false;
|
||||
}
|
||||
|
||||
$this->assertEquals($return, $this->ba->generate_from_id($id));
|
||||
$this->assertEquals($return, call_user_func(array('ComicPressBackendAttachment', 'generate_from_id'), $id));
|
||||
}
|
||||
|
||||
function testGetInfo() {
|
||||
|
|
Loading…
Reference in New Issue