explicitly mark some block types as ignored when calculating 404ness
This commit is contained in:
parent
3c3529a4cc
commit
473c0f0bcb
@ -44,6 +44,14 @@ class Block {
|
|||||||
*/
|
*/
|
||||||
public $id;
|
public $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should this block count as content for the sake of
|
||||||
|
* the 404 handler
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
public $is_content = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a block.
|
* Construct a block.
|
||||||
*
|
*
|
||||||
|
@ -42,7 +42,9 @@ class Blocks extends Extension {
|
|||||||
foreach($blocks as $block) {
|
foreach($blocks as $block) {
|
||||||
$path = implode("/", $event->args);
|
$path = implode("/", $event->args);
|
||||||
if(strlen($path) < 4000 && fnmatch($block['pages'], $path)) {
|
if(strlen($path) < 4000 && fnmatch($block['pages'], $path)) {
|
||||||
$page->add_block(new Block($block['title'], $block['content'], $block['area'], $block['priority']));
|
$b = new Block($block['title'], $block['content'], $block['area'], $block['priority']);
|
||||||
|
$b->is_content = false;
|
||||||
|
$page->add_block($b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ class Chatbox extends Extension {
|
|||||||
// loads the chatbox at the set location
|
// loads the chatbox at the set location
|
||||||
$html = "<div id=\"yshout\"></div>";
|
$html = "<div id=\"yshout\"></div>";
|
||||||
$chatblock = new Block("Chatbox", $html, "main", 97);
|
$chatblock = new Block("Chatbox", $html, "main", 97);
|
||||||
|
$chatblock->is_content = false;
|
||||||
$page->add_block($chatblock);
|
$page->add_block($chatblock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,10 +43,7 @@ class Handle404 extends Extension {
|
|||||||
private function count_main($blocks) {
|
private function count_main($blocks) {
|
||||||
$n = 0;
|
$n = 0;
|
||||||
foreach($blocks as $block) {
|
foreach($blocks as $block) {
|
||||||
if($block->section == "main") $n++; // more hax.
|
if($block->section == "main" && $block->is_content) $n++; // more hax.
|
||||||
}
|
|
||||||
if(ext_is_live("Chatbox")) {
|
|
||||||
$n--; // even more hax.
|
|
||||||
}
|
}
|
||||||
return $n;
|
return $n;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user