Exemplo n.º 1
0
function formatar($texto)
{
    $not_bracket = "[^\\]]";
    $brreg = "/\n/";
    $brrep = "<br>";
    $linkreg = "/\\[({$not_bracket}+)\\|({$not_bracket}+)\\]/";
    $linkrep = "<a target=\"_blank\" href=\"\$1\">\$2</a>";
    $nbspreg = "/^ +/";
    $nbsprep = "&nbsp;";
    $imgreg = "/\\[imagem:({$not_bracket}+)\\]/";
    $imgrep = "<a target=\"_blank\" title=\"Clique para ver o tamanho completo.\" href=\"\$1\"><img src=\"\$1\"></a>";
    $h4reg = "/\\[big\\]/";
    $h4rep = "<div class=\"big\">";
    $hcreg = "/\\[\\/big\\]/";
    $hcrep = "</div>";
    $colorreg = "/\\[cor:({$not_bracket}+)\\]/";
    $colorrep = "<span class=\"colored\" style=\"color: \$1;\">";
    $endcolorreg = "/\\[\\/cor\\]/";
    $endcolorrep = "</span>";
    $fourreg = "/    /";
    $fourrep = "&nbsp;&nbsp;&nbsp;&nbsp;";
    $tags = "table|tr|td|sub|sup|b|i|u|s|code|br|hr";
    $tagreg = "/\\[(({$tags})|(\\/({$tags})))\\]/";
    $tagrep = "<\$1>";
    $tablereg = "/<table>/";
    $tablerep = "<table class=\"restable\">";
    $texto = htmlspecialchars($texto);
    $texto = substituir_global("/\\{l\\}/", "ℓ", $texto);
    $texto = substituir_global("/\\{g\\}/", "[sup]↗[/sup]", $texto);
    $texto = substituir_global($fourreg, $fourrep, $texto);
    $texto = substituir_global($linkreg, $linkrep, $texto);
    $texto = substituir_global($nbspreg, $nbsprep, $texto);
    $texto = substituir_global($imgreg, $imgrep, $texto);
    $texto = substituir_global($h4reg, $h4rep, $texto);
    $texto = substituir_global($hcreg, $hcrep, $texto);
    $texto = substituir_global($colorreg, $colorrep, $texto);
    $texto = substituir_global($endcolorreg, $endcolorrep, $texto);
    $texto = substituir_global($tagreg, $tagrep, $texto);
    $texto = substituir_global($tablereg, $tablerep, $texto);
    return $texto;
}
Exemplo n.º 2
0
}
$resumos = getFullJSON();
$resumo = null;
foreach ($resumos as $found) {
    if ($found["mini"] == $mini) {
        $resumo = $found;
        break;
    }
}
if (is_null($resumo)) {
    redir("..");
}
$materia = $resumo["materia"];
$autoria = $resumo["autor"];
$assunto = $resumo["assunto"];
$conteudo = substituir_global("/color\\:/", "c_o_l_o_r:", formatar($resumo["conteudo"]));
$ano = $resumo["ano"];
$guid = $resumo["guid"];
?>

<html>
    <head>
        <title>Imprimir Resumo</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <style>
            <?php 
echo file_get_contents("outros/resumos.css");
?>
            body {
                background-color: white;
            }