"> // escape an attribute // partial('Include/matsit_incl.php', array( // render a partial with vars // 'matchId' => $id, // )); // // Benefits: e() makes "did I escape this?" answerable at a glance and B5 can // sweep raw `echo $var` -> `echo e($var)` mechanically. partial() gives the // duplicated *_incl.php fragments a single render path with explicit inputs // instead of relying on leaked globals (C4 dedup target). // Escape a value for safe output inside HTML text or a double/single-quoted // attribute. ENT_QUOTES covers both quote styles; UTF-8 matches the charset // sent by bootstrap.php. Null/ints/floats are cast to string first so callers // don't have to guard them. function e($value) { if ($value === null) { return ''; } return htmlspecialchars((string) $value, ENT_QUOTES, 'UTF-8'); } // Render a PHP partial in an isolated scope with only the variables it is // given. $vars keys become local variables inside the partial, so fragments // declare their inputs instead of reaching into page globals. Path is relative // to the project root (the directory above Include/). function partial($path, $vars = array()) { $full = __DIR__ . '/../' . ltrim($path, '/'); if (!is_file($full)) { error_log('partial(): missing file -- ' . $full); return; } extract($vars, EXTR_SKIP); include $full; }
Löydettiin 8 replaytä.
| Pelaaja1 | Pelaaja2 | Map | Liiga | DL | Lisätty | Lisääjä | Lataa | |
|---|---|---|---|---|---|---|---|---|
moilis |
Hymy |
Dusk Towers | Custom | 476 | 2015/11/23 | Hymy | ![]() | |
moilis |
Hymy |
Dusk Towers | Custom | 474 | 2015/11/23 | Hymy | ![]() | |
moilis |
Myorg |
Ruins of Seras | Custom | 460 | 2015/11/19 | Myorg | ![]() | |
Myorg |
moilis |
Dusk Towers | Custom | 463 | 2015/11/19 | Myorg | ![]() | |
moilis |
Myorg |
Central Protocol | Custom | 431 | 2015/11/19 | Myorg | ![]() | |
moilis |
Luolis |
Prion Terraces | Custom | 453 | 2015/11/18 | Luolis | ![]() | |
moilis |
Luolis |
Ulrena | Custom | 489 | 2015/11/18 | Luolis | ![]() | |
moilis |
Tropic |
Dusk Towers | Custom | 466 | 2015/11/16 | trooppinen | ![]() |