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

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

View file

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