Storing copies of config variables outside of for loops.
This commit is contained in:
parent
0a1e8f2af4
commit
68e9bd694e
5 changed files with 30 additions and 13 deletions
|
@ -289,7 +289,11 @@ class Page {
|
|||
{
|
||||
global $config;
|
||||
|
||||
if (!$config->get_bool("autocache_css") && !$config->get_bool("autocache_js")) {
|
||||
// store local copy for speed.
|
||||
$autocache_css = $config->get_bool("autocache_css");
|
||||
$autocache_js = config->get_bool("autocache_js")
|
||||
|
||||
if (!$autocache_css && !$autocache_js) {
|
||||
return false; // caching disabled
|
||||
}
|
||||
|
||||
|
@ -307,7 +311,7 @@ class Page {
|
|||
$data_href = get_base_href();
|
||||
|
||||
/* ----- CSS Files ----- */
|
||||
if ($config->get_bool("autocache_css"))
|
||||
if ($autocache_css)
|
||||
{
|
||||
// First get all the CSS from the lib directory
|
||||
$contents_from_lib = '';
|
||||
|
@ -374,7 +378,7 @@ class Page {
|
|||
|
||||
|
||||
/* ----- JavaScript Files ----- */
|
||||
if ($config->get_bool("autocache_js"))
|
||||
if ($autocache_js)
|
||||
{
|
||||
$data = '';
|
||||
$js_files = glob("lib/*.js");
|
||||
|
|
|
@ -35,14 +35,17 @@ class CommentListTheme extends Themelet {
|
|||
|
||||
// parts for each image
|
||||
$position = 10;
|
||||
|
||||
$comment_limit = $config->get_int("comment_list_count", 10);
|
||||
$comment_captcha = $config->get_bool('comment_captcha');
|
||||
|
||||
foreach($images as $pair) {
|
||||
$image = $pair[0];
|
||||
$comments = $pair[1];
|
||||
|
||||
$thumb_html = $this->build_thumb_html($image);
|
||||
|
||||
$comment_html = "";
|
||||
$comment_limit = $config->get_int("comment_list_count", 10);
|
||||
|
||||
$comment_count = count($comments);
|
||||
if($comment_limit > 0 && $comment_count > $comment_limit) {
|
||||
$hidden = $comment_count - $comment_limit;
|
||||
|
@ -59,7 +62,7 @@ class CommentListTheme extends Themelet {
|
|||
}
|
||||
} else {
|
||||
if ($can_post) {
|
||||
if(!$config->get_bool('comment_captcha')) {
|
||||
if(!$comment_captcha) {
|
||||
$comment_html .= $this->build_postbox($image->id);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -70,6 +70,7 @@ class TagListTheme extends Themelet {
|
|||
public function display_popular_block(Page $page, $tag_infos) {
|
||||
global $config;
|
||||
|
||||
// store local copies for speed.
|
||||
$info_link = $config->get_string('info_link');
|
||||
$tag_list_num = $config->get_bool("tag_list_numbers");
|
||||
|
||||
|
@ -107,19 +108,23 @@ class TagListTheme extends Themelet {
|
|||
public function display_refine_block(Page $page, $tag_infos, $search) {
|
||||
global $config;
|
||||
|
||||
// store local copy for speed.
|
||||
$info_link = $config->get_string('info_link');
|
||||
|
||||
$html = "";
|
||||
$n = 0;
|
||||
|
||||
foreach($tag_infos as $row) {
|
||||
$tag = $row['tag'];
|
||||
$h_tag = html_escape($tag);
|
||||
$h_tag_no_underscores = str_replace("_", " ", $h_tag);
|
||||
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>";
|
||||
$html .= ' <a class="tag_name" href="'.$link.'">'.$h_tag_no_underscores.'</a>';
|
||||
$html .= $this->ars($tag, $search);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ class UploadTheme extends Themelet {
|
|||
$upload_list = "";
|
||||
$upload_count = $config->get_int('upload_count');
|
||||
|
||||
|
||||
for($i=0; $i<$upload_count; $i++)
|
||||
{
|
||||
$a=$i+1;
|
||||
|
@ -53,7 +54,7 @@ class UploadTheme extends Themelet {
|
|||
<a href='#' onclick='$js'>".
|
||||
"<img src='ext/upload/minus.png' /></a>";
|
||||
|
||||
if($a==$config->get_int('upload_count')){
|
||||
if($a == $upload_count){
|
||||
$upload_list .="<img id='wrapper' src='ext/upload/plus.png' />";
|
||||
}else{
|
||||
$js1 = 'javascript:$(function() {
|
||||
|
|
|
@ -25,6 +25,10 @@ class CustomCommentListTheme extends CommentListTheme {
|
|||
|
||||
// parts for each image
|
||||
$position = 10;
|
||||
|
||||
$comment_captcha = $config->get_bool('comment_captcha');
|
||||
$comment_limit = $config->get_int("comment_list_count", 10);
|
||||
|
||||
foreach($images as $pair) {
|
||||
$image = $pair[0];
|
||||
$comments = $pair[1];
|
||||
|
@ -42,7 +46,7 @@ class CustomCommentListTheme extends CommentListTheme {
|
|||
|
||||
$r = class_exists("Ratings") ? "<b>Rating</b> ".Ratings::rating_to_human($image->rating) : "";
|
||||
$comment_html = "<b>Date</b> $p $s <b>User</b> $un $s $r<br><b>Tags</b> $t<p> ";
|
||||
$comment_limit = $config->get_int("comment_list_count", 10);
|
||||
|
||||
$comment_count = count($comments);
|
||||
if($comment_limit > 0 && $comment_count > $comment_limit) {
|
||||
$hidden = $comment_count - $comment_limit;
|
||||
|
@ -57,7 +61,7 @@ class CustomCommentListTheme extends CommentListTheme {
|
|||
$comment_html .= $this->build_postbox($image->id);
|
||||
}
|
||||
else {
|
||||
if(!$config->get_bool('comment_captcha')) {
|
||||
if(!$comment_captcha) {
|
||||
$comment_html .= $this->build_postbox($image->id);
|
||||
}
|
||||
else {
|
||||
|
|
Reference in a new issue