=====Bingo Action=====
>>==See also:==
Documentation: BingoActionInfo.>>This is the development page for the bingo action.::c::
the php code:
%%(php)
\n";
for ($i = 0; $i < 25; $i++) {
if (($i % 5) == 0) print "
\n";
if ($i < 12) {
print "" . $words[$i] . " | \n";
} elseif ($i == 12) {
print "" . $wakka->ReturnSafeHtml($joker) . " | \n";
} else {
print "" . $words[$i-1] . " | \n";
}
if ((($i + 1) % 5) == 0) print "
\n";
}
print "";
}
// Init & Check-Up
srand ((float)microtime()*1000000);
if (!is_array($vars)) {
print "Error in action call, please refer to the documentation, aborting!";
} elseif (!is_string($vars["seed"])) {
print "You need to specify a seed for the game card creation, aborting!";
} elseif (!preg_match($bingo_validseed,$vars["seed"])) {
print "The seed you supplied is no valid page name, aborting!";
} elseif (!$this->ExistsPage($vars["seed"])) {
print "The seed you supplied is no existing page, aborting!";
} elseif ($page = $this->LoadPage($vars["seed"])) {
if(is_string($vars["joker"])) {
$bingo_joker = $vars["joker"];
}
// Get the words, clean up and shuffle
$bingo_words = explode($bingo_delimiter,$page["body"]);
$bingo_words = array_filter($bingo_words,"cleanup");
$bingo_words = array_unique($bingo_words);
shuffle($bingo_words);
// We need an array of 24 words
$bingo_size = sizeof($bingo_words);
if ($bingo_size < 12) {
print "Your seed contains less than 12 valid words, aborting!";
} else {
if ($bingo_size < 24) {
$bingo_words = array_merge($bingo_words,$bingo_words);
}
if ($bingo_size > 24) {
$bingo_words = array_slice($bingo_words,0,24);
}
print_card($bingo_words,$bingo_joker);
}
} else {
print "Unknown Error, aborting!";
}
?>
%%
====example css====
%%(css)
.bingocard {
border: 1px solid #000;
border-collapse: collapse;
margin: 5px;
}
.bingorow td {
border: 1px solid #000;
padding: 3px;
text-align: center;
}
.bingojoker {
background: #09d;
}
%%
----
CategoryUserContributions