From b01ca892207d6bae220b4ca7172c146ed01ecd97 Mon Sep 17 00:00:00 2001 From: jgen Date: Fri, 4 Oct 2013 17:53:26 -0400 Subject: [PATCH] Some more small speed related tweaks. --- core/config.class.php | 4 ++-- ext/artists/main.php | 8 ++++---- ext/chatbox/history/index.php | 2 +- themes/danbooru/layout.class.php | 4 +++- themes/danbooru2/layout.class.php | 4 +++- themes/lite/layout.class.php | 8 ++++++-- 6 files changed, 19 insertions(+), 11 deletions(-) diff --git a/core/config.class.php b/core/config.class.php index 66d5d58a..538dd496 100644 --- a/core/config.class.php +++ b/core/config.class.php @@ -69,7 +69,7 @@ abstract class BaseConfig implements Config { $this->save($name); } public function set_array(/*string*/ $name, $value) { - assert(is_array($value)); + assert(isset($value) && is_array($value)); $this->values[$name] = implode(",", $value); $this->save($name); } @@ -90,7 +90,7 @@ abstract class BaseConfig implements Config { } } public function set_default_array(/*string*/ $name, $value) { - assert(is_array($value)); + assert(isset($value) && is_array($value)); if(is_null($this->get($name))) { $this->values[$name] = implode(",", $value); } diff --git a/ext/artists/main.php b/ext/artists/main.php index a4b3d6c3..d426d512 100644 --- a/ext/artists/main.php +++ b/ext/artists/main.php @@ -112,7 +112,7 @@ class Artists extends Extension { global $database; $author = strtolower($event->author); - if (strlen($author) == 0 || strpos($author, " ")) + if (strlen($author) === 0 || strpos($author, " ")) return; $paddedAuthor = str_replace(" ", "_", $author); @@ -709,7 +709,7 @@ class Artists extends Extension { if (is_null($aliasID) || !is_numeric($aliasID)) return; - if (is_null($alias) || strlen($alias) == 0) + if (is_null($alias) || strlen($alias) === 0) return; global $user; @@ -767,7 +767,7 @@ class Artists extends Extension { if (is_null($memberID) || !is_numeric($memberID)) return; - if (is_null($memberName) || strlen($memberName) == 0) + if (is_null($memberName) || strlen($memberName) === 0) return; global $user; @@ -796,7 +796,7 @@ class Artists extends Extension { global $user; $name = html_escape(strtolower($_POST["name"])); - if (is_null($name) || (strlen($name) == 0) || strpos($name, " ")) + if (is_null($name) || (strlen($name) === 0) || strpos($name, " ")) return -1; $notes = html_escape(ucfirst($_POST["notes"])); diff --git a/ext/chatbox/history/index.php b/ext/chatbox/history/index.php index 681dfc8c..94642523 100644 --- a/ext/chatbox/history/index.php +++ b/ext/chatbox/history/index.php @@ -23,7 +23,7 @@ $ys = ys($log); $posts = $ys->posts(); - if (sizeof($posts) == 0) + if (sizeof($posts) === 0) $html .= '
diff --git a/themes/danbooru/layout.class.php b/themes/danbooru/layout.class.php index dbe89cf6..611d8df6 100644 --- a/themes/danbooru/layout.class.php +++ b/themes/danbooru/layout.class.php @@ -256,7 +256,9 @@ EOD; $url=$matches[1][0]; } - for($i=0;$i