Store config values that are used inside a loop.

This commit is contained in:
green-ponies (jgen) 2012-02-04 12:20:49 -05:00
parent 1a8c2d31c7
commit 0a1e8f2af4
2 changed files with 12 additions and 6 deletions

View File

@ -70,22 +70,26 @@ class TagListTheme extends Themelet {
public function display_popular_block(Page $page, $tag_infos) { public function display_popular_block(Page $page, $tag_infos) {
global $config; global $config;
$info_link = $config->get_string('info_link');
$tag_list_num = $config->get_bool("tag_list_numbers");
$html = ""; $html = "";
$n = 0; $n = 0;
foreach($tag_infos as $row) { foreach($tag_infos as $row) {
$tag = $row['tag']; $tag = $row['tag'];
$h_tag = html_escape($tag); $h_tag = html_escape($tag);
$h_tag_no_underscores = str_replace("_", " ", $h_tag); $h_tag_no_underscores = str_replace("_", " ", $h_tag);
$count = $row['count']; $count = $row['count'];
if($n++) $html .= "\n<br/>"; if($n++) $html .= "\n<br/>";
if(!is_null($config->get_string('info_link'))) { if(!is_null($info_link)) {
$link = str_replace('$tag', $tag, $config->get_string('info_link')); $link = str_replace('$tag', $tag, $info_link);
$html .= " <a class='tag_info_link' href='$link'>?</a>"; $html .= ' <a class="tag_info_link" href="'.$link.'">?</a>';
} }
$link = $this->tag_link($row['tag']); $link = $this->tag_link($row['tag']);
$html .= " <a class='tag_name' href='$link'>$h_tag_no_underscores</a>"; $html .= ' <a class="tag_name" href="$link">'.$h_tag_no_underscores.'</a>';
if($config->get_bool("tag_list_numbers")) { if($tag_list_num) {
$html .= " <span class='tag_count'>$count</span>"; $html .= ' <span class="tag_count">'.$count.'</span>';
} }
} }

View File

@ -58,6 +58,8 @@ class Upload extends SimpleExtension {
$this->is_full = false; $this->is_full = false;
} }
else { else {
// TODO: This size limit should be configureable by the admin...
// currently set to 100 MB
$this->is_full = $free_num < 100*1024*1024; $this->is_full = $free_num < 100*1024*1024;
} }