strict warnings cleanup and phpunit.xml setup
This commit is contained in:
parent
e32f66ba48
commit
d94905eaa6
|
@ -1,3 +1,5 @@
|
|||
*~
|
||||
.directory
|
||||
|
||||
.buildpath
|
||||
.project
|
||||
.settings/
|
||||
|
|
|
@ -234,7 +234,7 @@ class ComicPress {
|
|||
"Layout Name", "Sidebars"
|
||||
) as $field) {
|
||||
if (preg_match('#/\*.*' . $field . ': ([^\n]+).*\*/#s', $content, $matches) > 0) {
|
||||
if (!is_array($this->layouts[$basename])) {
|
||||
if (!isset($this->layouts[$basename])) {
|
||||
$this->layouts[$basename] = array();
|
||||
}
|
||||
$this->layouts[$basename][$field] = $matches[1];
|
||||
|
@ -292,7 +292,8 @@ class ComicPress {
|
|||
$sorted_categories = array();
|
||||
|
||||
foreach ($this->category_tree as $node) {
|
||||
$category_id = end(explode("/", $node));
|
||||
$parts = explode("/", $node);
|
||||
$category_id = end($parts);
|
||||
if (in_array($category_id, $categories)) {
|
||||
$sorted_categories[] = $category_id;
|
||||
}
|
||||
|
|
|
@ -79,7 +79,11 @@ class ComicPressComicPost {
|
|||
$dimensions = array();
|
||||
|
||||
if (isset($this->comicpress->comicpress_options["${type}_dimensions"])) {
|
||||
list($width, $height) = explode("x", $this->comicpress->comicpress_options["${type}_dimensions"]);
|
||||
$parts = explode("x", $this->comicpress->comicpress_options["${type}_dimensions"]);
|
||||
switch (count($parts)) {
|
||||
case 1: list($width) = $parts; break;
|
||||
case 2: list($width, $height) = $parts; break;
|
||||
}
|
||||
$dimensions = compact('width', 'height');
|
||||
}
|
||||
|
||||
|
@ -145,6 +149,7 @@ class ComicPressComicPost {
|
|||
}
|
||||
|
||||
foreach ($remaining_posts_to_sort as $type => $posts) {
|
||||
if (!isset($comic_image_ordering[$type])) { $comic_image_ordering[$type] = array(); }
|
||||
if (is_array($comic_image_ordering[$type])) {
|
||||
$comic_image_ordering[$type] = array_merge($comic_image_ordering[$type], $posts);
|
||||
} else {
|
||||
|
@ -158,8 +163,16 @@ class ComicPressComicPost {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the remaining comic images by file date.
|
||||
* @param object $a
|
||||
* @param object $b
|
||||
* @return int
|
||||
*/
|
||||
function sort_remaining_comic_images($a, $b) {
|
||||
return strtotime($a->post_date) - strtotime($b->post_date);
|
||||
$a_date = isset($a->post_date) ? $a->post_date : 0;
|
||||
$b_date = isset($b->post_date) ? $b->post_date : 0;
|
||||
return $a_date - $b_date;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -58,7 +58,11 @@ class ComicPressStoryline {
|
|||
$structure = explode(',', $structure);
|
||||
} else {
|
||||
if (is_array($structure)) {
|
||||
$key = implode(',', $structure);
|
||||
$fixed_structure = array();
|
||||
foreach ($structure as $s) {
|
||||
if (!is_array($s)) { $fixed_structure[] = $s; }
|
||||
}
|
||||
$key = implode(',', $fixed_structure);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -383,12 +387,14 @@ class ComicPressStoryline {
|
|||
$found_children = false;
|
||||
foreach ($this->_structure as $category_id => $info) {
|
||||
if (!in_array($category_id, $children)) {
|
||||
if (isset($info['parent'])) {
|
||||
if (in_array($info['parent'], $children)) {
|
||||
$children[] = $category_id;
|
||||
$found_children = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} while ($found_children);
|
||||
|
||||
return $children;
|
||||
|
|
|
@ -149,7 +149,9 @@ class ComicPressAdminTest extends PHPUnit_Framework_TestCase {
|
|||
|
||||
$_POST = $change;
|
||||
|
||||
if (isset($_POST['cp'])) {
|
||||
$this->admin->handle_update_comicpress_options($_POST['cp']);
|
||||
}
|
||||
|
||||
foreach ($new as $key => $value) {
|
||||
$this->assertEquals($value, $this->admin->comicpress->comicpress_options[$key]);
|
||||
|
@ -273,7 +275,7 @@ class ComicPressAdminTest extends PHPUnit_Framework_TestCase {
|
|||
|
||||
$this->admin->handle_update_override_partial(array_merge(compact('code', 'action'), array('partial' => 'index')));
|
||||
|
||||
if ($result && $action == "Update partial") {
|
||||
if ($action == "Update partial") {
|
||||
$this->assertEquals($code, $this->admin->comicpress->comicpress_options['override_partials']['index']);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue