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);
}
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);
}

View file

@ -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"]));

View file

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

View file

@ -256,7 +256,9 @@ EOD;
$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]) {
$html = "<li class='current-page'><a href='$link'>$desc</a></li>";
}

View file

@ -282,7 +282,9 @@ EOD;
$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]) {
$html = "<li class='current-page'><a href='$link'>$desc</a></li>";
}

View file

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