remove dumb feature, just extend the class, doi
This commit is contained in:
parent
e02cfc4df6
commit
4d998aefb8
@ -120,7 +120,7 @@ class ComicPressBackendFilesystemFactory {
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function process_search_string($post, $type, $filename = null, $replace_object = null) {
|
function process_search_string($post, $type, $filename = null) {
|
||||||
$this->_searches = array($this->search_string);
|
$this->_searches = array($this->search_string);
|
||||||
$this->_filename = $filename;
|
$this->_filename = $filename;
|
||||||
|
|
||||||
@ -135,23 +135,16 @@ class ComicPressBackendFilesystemFactory {
|
|||||||
'_replace_' . strtolower(str_replace('-', '_', $matches[1])) => null,
|
'_replace_' . strtolower(str_replace('-', '_', $matches[1])) => null,
|
||||||
'_replace_' . strtolower($parts[0]) => implode('-', array_slice($parts, 1))
|
'_replace_' . strtolower($parts[0]) => implode('-', array_slice($parts, 1))
|
||||||
) as $method => $additional) {
|
) as $method => $additional) {
|
||||||
$object_calls = array($this);
|
if (method_exists($this, $method)) {
|
||||||
if (is_object($replace_object)) {
|
|
||||||
array_unshift($object_calls, $replace_object);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($object_calls as $obj) {
|
|
||||||
if (method_exists($obj, $method)) {
|
|
||||||
$any_found = true;
|
$any_found = true;
|
||||||
$found = true;
|
$found = true;
|
||||||
$result = $obj->{$method}($post, $type, $additional);
|
$result = $this->{$method}($post, $type, $additional);
|
||||||
if ($result !== false) {
|
if ($result !== false) {
|
||||||
$this->_searches[$i] = str_replace($matches[0], $result, $search);
|
$this->_searches[$i] = str_replace($matches[0], $result, $search);
|
||||||
break 2;
|
break;
|
||||||
} else {
|
} else {
|
||||||
// array state change, start over
|
// array state change, start over
|
||||||
break 2;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
Plugin Name: ComicPress Core
|
Plugin Name: ComicPress Core
|
||||||
Plugin URI: http://comicpress.org/
|
Plugin URI: http://core.comicpress.org/
|
||||||
Description: Provides the core functionality of ComicPress, a powerful media and structured category management system geared toward creative works.
|
Description: Provides the core functionality of ComicPress, a powerful media and structured category management system geared toward creative works.
|
||||||
Version: 1.0
|
Version: 1.0
|
||||||
Author: John Bintz
|
Author: John Bintz
|
||||||
Author URI: http://comicpress.org/
|
Author URI: http://comicpress.org/
|
||||||
|
|
||||||
Copyright 2009 John Bintz (email : john@coswellproductions.com)
|
Copyright 2009-2010 John Bintz (email : john@coswellproductions.com)
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -393,18 +393,4 @@ class ComicPressBackendFilesystemFactoryTest extends PHPUnit_Framework_TestCase
|
|||||||
)
|
)
|
||||||
), $fa->get_urls_for_post_roots($roots, (object)array('post_date' => '2010-01-01')));
|
), $fa->get_urls_for_post_roots($roots, (object)array('post_date' => '2010-01-01')));
|
||||||
}
|
}
|
||||||
|
|
||||||
function testProvideReplaceObject() {
|
|
||||||
$fa = $this->getMock('ComicPressBackendFilesystemFactory', array('_replace_wordpress', '_replace_type'));
|
|
||||||
|
|
||||||
$fa->search_string = '%wordpress%/%type%';
|
|
||||||
|
|
||||||
$fa->expects($this->once())->method('_replace_wordpress')->will($this->returnValue('wordpress'));
|
|
||||||
$fa->expects($this->never())->method('_replace_type');
|
|
||||||
|
|
||||||
$replace = $this->getMock('ReplaceObject', array('_replace_type'));
|
|
||||||
$replace->expects($this->once())->method('_replace_type')->will($this->returnValue('type'));
|
|
||||||
|
|
||||||
$this->assertEquals(array('wordpress/type'), $fa->process_search_string(null, 'type', null, $replace));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user