Some more small speed related tweaks.

This commit is contained in:
jgen 2013-10-04 17:53:26 -04:00
parent 0512858bd4
commit b01ca89220
6 changed files with 19 additions and 11 deletions

View File

@ -69,7 +69,7 @@ abstract class BaseConfig implements Config {
$this->save($name); $this->save($name);
} }
public function set_array(/*string*/ $name, $value) { public function set_array(/*string*/ $name, $value) {
assert(is_array($value)); assert(isset($value) && is_array($value));
$this->values[$name] = implode(",", $value); $this->values[$name] = implode(",", $value);
$this->save($name); $this->save($name);
} }
@ -90,7 +90,7 @@ abstract class BaseConfig implements Config {
} }
} }
public function set_default_array(/*string*/ $name, $value) { public function set_default_array(/*string*/ $name, $value) {
assert(is_array($value)); assert(isset($value) && is_array($value));
if(is_null($this->get($name))) { if(is_null($this->get($name))) {
$this->values[$name] = implode(",", $value); $this->values[$name] = implode(",", $value);
} }

View File

@ -112,7 +112,7 @@ class Artists extends Extension {
global $database; global $database;
$author = strtolower($event->author); $author = strtolower($event->author);
if (strlen($author) == 0 || strpos($author, " ")) if (strlen($author) === 0 || strpos($author, " "))
return; return;
$paddedAuthor = str_replace(" ", "_", $author); $paddedAuthor = str_replace(" ", "_", $author);
@ -709,7 +709,7 @@ class Artists extends Extension {
if (is_null($aliasID) || !is_numeric($aliasID)) if (is_null($aliasID) || !is_numeric($aliasID))
return; return;
if (is_null($alias) || strlen($alias) == 0) if (is_null($alias) || strlen($alias) === 0)
return; return;
global $user; global $user;
@ -767,7 +767,7 @@ class Artists extends Extension {
if (is_null($memberID) || !is_numeric($memberID)) if (is_null($memberID) || !is_numeric($memberID))
return; return;
if (is_null($memberName) || strlen($memberName) == 0) if (is_null($memberName) || strlen($memberName) === 0)
return; return;
global $user; global $user;
@ -796,7 +796,7 @@ class Artists extends Extension {
global $user; global $user;
$name = html_escape(strtolower($_POST["name"])); $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; return -1;
$notes = html_escape(ucfirst($_POST["notes"])); $notes = html_escape(ucfirst($_POST["notes"]));

View File

@ -23,7 +23,7 @@
$ys = ys($log); $ys = ys($log);
$posts = $ys->posts(); $posts = $ys->posts();
if (sizeof($posts) == 0) if (sizeof($posts) === 0)
$html .= ' $html .= '
<div id="ys-post-1" class="ys-post ys-first ys-admin-post"> <div id="ys-post-1" class="ys-post ys-first ys-admin-post">
<span class="ys-post-timestamp">13:37</span> <span class="ys-post-timestamp">13:37</span>

View File

@ -256,7 +256,9 @@ EOD;
$url=$matches[1][0]; $url=$matches[1][0];
} }
for($i=0;$i<count($pages_matched);$i++) { $count_pages_matched = count($pages_matched);
for($i=0; $i < $count_pages_matched; $i++) {
if($url == $pages_matched[$i]) { if($url == $pages_matched[$i]) {
$html = "<li class='current-page'><a href='$link'>$desc</a></li>"; $html = "<li class='current-page'><a href='$link'>$desc</a></li>";
} }

View File

@ -282,7 +282,9 @@ EOD;
$url=$matches[1][0]; $url=$matches[1][0];
} }
for($i=0;$i<count($pages_matched);$i++) { $count_pages_matched = count($pages_matched);
for($i=0; $i < $count_pages_matched; $i++) {
if($url == $pages_matched[$i]) { if($url == $pages_matched[$i]) {
$html = "<li class='current-page'><a href='$link'>$desc</a></li>"; $html = "<li class='current-page'><a href='$link'>$desc</a></li>";
} }

View File

@ -216,7 +216,7 @@ EOD;
} else { } else {
$html .= "<div class='navtop navside tab shm-toggler' data-toggle-sel='#$i'>$h</div>"; $html .= "<div class='navtop navside tab shm-toggler' data-toggle-sel='#$i'>$h</div>";
} }
} }
if(!is_null($b)) { if(!is_null($b)) {
if($salt =="main") { if($salt =="main") {
$html .= "<div class='blockbody'>$b</div>"; $html .= "<div class='blockbody'>$b</div>";
@ -245,12 +245,16 @@ EOD;
$url=$matches[1][0]; $url=$matches[1][0];
} }
for($i=0;$i<count($pages_matched);$i++) { $count_pages_matched = count($pages_matched);
for($i=0; $i < $count_pages_matched; $i++) {
if($url == $pages_matched[$i]) { if($url == $pages_matched[$i]) {
$html = "<a class='tab-selected' href='$link'>$desc</a>"; $html = "<a class='tab-selected' href='$link'>$desc</a>";
} }
} }
if(is_null($html)) {$html = "<a class='tab' href='$link'>$desc</a>";} if(is_null($html)) {$html = "<a class='tab' href='$link'>$desc</a>";}
return $html; return $html;
} }
} }