diff --git a/contrib/artists/main.php b/contrib/artists/main.php
index f035224a..9f057bc6 100644
--- a/contrib/artists/main.php
+++ b/contrib/artists/main.php
@@ -904,8 +904,10 @@ class Artists implements Extension {
, array(
$artistID
));
-
- for ($i = 0 ; $i < count($result) ; $i++)
+
+ $num = count($result);
+
+ for ($i = 0 ; $i < $num ; $i++)
{
$result[$i]["name"] = stripslashes($result[$i]["name"]);
}
@@ -921,8 +923,10 @@ class Artists implements Extension {
, array(
$artistID
));
+
+ $num = count($result);
- for ($i = 0 ; $i < count($result) ; $i++)
+ for ($i = 0 ; $i < $num ; $i++)
{
$result[$i]["url"] = stripslashes($result[$i]["url"]);
}
@@ -1038,8 +1042,10 @@ class Artists implements Extension {
$pageNumber * $artistsPerPage
, $artistsPerPage
));
+
+ $number_of_listings = count($listing);
- for ($i = 0 ; $i < count($listing) ; $i++)
+ for ($i = 0 ; $i < $number_of_listings ; $i++)
{
$listing[$i]["name"] = stripslashes($listing[$i]["name"]);
$listing[$i]["user_name"] = stripslashes($listing[$i]["user_name"]);
diff --git a/contrib/blotter/theme.php b/contrib/blotter/theme.php
index e8d82860..fd78b467 100644
--- a/contrib/blotter/theme.php
+++ b/contrib/blotter/theme.php
@@ -55,7 +55,8 @@ class BlotterTheme extends Themelet {
// Now, time for entries list.
$table_rows = "";
- for ($i = 0 ; $i < count($entries) ; $i++)
+ $num_entries = count($entries);
+ for ($i = 0 ; $i < $num_entries ; $i++)
{
/**
* Add table rows
@@ -106,7 +107,8 @@ class BlotterTheme extends Themelet {
$html .= "
Blotter
";
- for ($i = 0 ; $i < count($entries) ; $i++)
+ $num_entries = count($entries);
+ for ($i = 0 ; $i < $num_entries ; $i++)
{
/**
* Blotter entries
@@ -156,7 +158,8 @@ $(document).ready(function() {
});
//-->";
$entries_list = "";
- for ($i = 0 ; $i < count($entries) ; $i++)
+ $num_entries = count($entries);
+ for ($i = 0 ; $i < $num_entries ; $i++)
{
/**
* Blotter entries
@@ -175,8 +178,8 @@ $(document).ready(function() {
$in_text = "";
$pos_break = "";
$pos_align = "text-align: right; position: absolute; right: 0px;";
- if($position == "left") { $pos_break = "
"; $pos_align = ""; }
- if(count($entries) == 0) { $out_text = "No blotter entries yet."; $in_text = "Empty.";}
+ if($position === "left") { $pos_break = "
"; $pos_align = ""; }
+ if(count($entries) === 0) { $out_text = "No blotter entries yet."; $in_text = "Empty.";}
else { $clean_date = date("m/d/y",strtotime($entries[0]['entry_date']));
$out_text = "Blotter updated: {$clean_date}";
$in_text = "
";
diff --git a/contrib/handle_flash/main.php b/contrib/handle_flash/main.php
index 8ee32fc0..eec6b1c1 100644
--- a/contrib/handle_flash/main.php
+++ b/contrib/handle_flash/main.php
@@ -56,7 +56,8 @@ class FlashFileHandler extends DataHandlerExtension {
private function str_to_binarray($string) {
$binary = array();
- for($j=0; $j=0; $i--) {
$binary[] = ($c >> $i) & 0x01;
diff --git a/contrib/home/main.php b/contrib/home/main.php
index f46c6238..855bc0ab 100644
--- a/contrib/home/main.php
+++ b/contrib/home/main.php
@@ -69,7 +69,8 @@ class Home extends SimpleExtension {
$num_comma = number_format($total);
$counter_text = "";
- for($n=0; $nterm, $matches)) {
$sqes = $matches[1];
$arr = array();
- for($i=0; $ipage_matches("comment")) {
- if($event->get_arg(0) == "add") {
+ if($event->get_arg(0) === "add") {
if(isset($_POST['image_id']) && isset($_POST['comment'])) {
try {
$cpe = new CommentPostingEvent($_POST['image_id'], $user, $_POST['comment']);
@@ -127,10 +127,10 @@ class CommentList extends SimpleExtension {
}
}
}
- else if($event->get_arg(0) == "delete") {
+ else if($event->get_arg(0) === "delete") {
if($user->is_admin()) {
// FIXME: post, not args
- if($event->count_args() == 3) {
+ if($event->count_args() === 3) {
send_event(new CommentDeletionEvent($event->get_arg(1)));
$page->set_mode("redirect");
if(!empty($_SERVER['HTTP_REFERER'])) {
@@ -145,7 +145,7 @@ class CommentList extends SimpleExtension {
$this->theme->display_permission_denied($page);
}
}
- else if($event->get_arg(0) == "list") {
+ else if($event->get_arg(0) === "list") {
$this->build_page($event->get_arg(1));
}
}
@@ -367,7 +367,7 @@ class CommentList extends SimpleExtension {
global $database;
// sqlite fails at intervals
- if($database->engine->name == "sqlite") return false;
+ if($database->engine->name === "sqlite") return false;
$window = int_escape($config->get_int('comment_window'));
$max = int_escape($config->get_int('comment_limit'));
diff --git a/ext/ext_manager/main.php b/ext/ext_manager/main.php
index b1763f2a..1e24b794 100644
--- a/ext/ext_manager/main.php
+++ b/ext/ext_manager/main.php
@@ -25,12 +25,13 @@ class ExtensionInfo {
function ExtensionInfo($main) {
$matches = array();
$lines = file($main);
+ $number_of_lines = count($lines);
preg_match("#(ext|contrib)/(.*)/main.php#", $main, $matches);
$this->ext_name = $matches[2];
$this->name = $this->ext_name;
$this->enabled = $this->is_enabled($this->ext_name);
- for($i=0; $iname = $matches[1];
diff --git a/ext/upload/theme.php b/ext/upload/theme.php
index 1b13bf9e..25c22242 100644
--- a/ext/upload/theme.php
+++ b/ext/upload/theme.php
@@ -15,7 +15,9 @@ class UploadTheme extends Themelet {
// Uploader 2.0!
$upload_list = "";
- for($i=0; $i<$config->get_int('upload_count'); $i++)
+ $upload_count = $config->get_int('upload_count');
+
+ for($i=0; $i<$upload_count; $i++)
{
$a=$i+1;
$s=$i-1;
@@ -244,7 +246,9 @@ class UploadTheme extends Themelet {
global $config;
$upload_list = "";
- for($i=0; $i<$config->get_int('upload_count'); $i++) {
+ $upload_count = $config->get_int('upload_count');
+
+ for($i=0; $i<$upload_count; $i++) {
if($i == 0) $style = ""; // "style='display:visible'";
else $style = "style='display:none'";
$upload_list .= "