function generar_layout() { //--- Barra SVN echo "<div class='editor-vista-previa'>" . $this->controlador()->get_info_archivo(); echo '<div>'; $this->generar_botones_eventos(true); echo '</div></div>'; //--- Barra de convenciones $mensajes_linea = array(); $modelo = toba_editor::get_modelo_proyecto(); $estandar = $modelo->get_estandar_convenciones(); $path = $this->controlador()->get_path_archivo(); if (file_exists($path)) { $resultado = $estandar->validar(array($path)); $titulo = '<strong>Convenciones</strong>'; $cant_errores = $resultado['totals']['errors']; $cant_warnings = $resultado['totals']['warnings']; $extra = ''; if ($cant_errores === 0 && $cant_warnings === 0) { $nivel = 'info'; $salida = 'Ok!'; } else { $nivel = $cant_errores !== 0 ? 'error' : 'warning'; $salida = "{$cant_errores} "; $salida .= $cant_errores !== 1 ? 'errores' : 'error'; $salida .= " / {$cant_warnings} "; $salida .= $cant_warnings !== 1 ? 'avisos' : 'aviso'; foreach ($resultado['files'][$path]['messages'] as $linea => $columnas) { $textos = array(); foreach ($columnas as $column => $mensajes) { foreach ($mensajes as $mensaje) { //$extra .= "<strong>$linea</strong>:{$mensaje['message']}"; $imagen = $mensaje['type'] == 'ERROR' ? 'error.gif' : 'warning.gif'; $textos[] = $estandar->parsear_mensaje($mensaje['message']); //Cambia el id de la convencion por una url } } $ayuda = implode('<br><br>', $textos); $ayuda = str_replace("'", "`", $ayuda); $mensajes_linea[$linea] = toba_recurso::imagen_toba($imagen, true, null, null, $ayuda); } } $this->generar_html_descripcion("{$titulo}: {$salida} {$extra}", $nivel); } //-- Vista previa echo "<div class='editor-vista-previa-codigo'>"; $codigo = $this->controlador()->get_previsualizacion(); require_once toba_dir() . '/php/3ros/PHP_Highlight.php'; $h = new PHP_Highlight(false); $h->loadString($codigo); $formato_linea = "<span class='editor-linea-codigo'>%02d</span> "; echo @$h->toHtml(true, true, $formato_linea, true, $mensajes_linea); echo '</div>'; }
echo '<span class="menuitem' . ($sec == $i ? '_sel' : '') . '" onmouseover="menusel(this)" onmouseout="menusel(this)" onclick="gosec(' . $i . ')">' . ($sec != $i ? '<a href="control.php?sec=' . $i . '">' . $item . '</a>' : $item) . '</span>'; } ?> </div> <div class="center"> <?php if (!isset($_GET['file']) || !is_file($_GET['file'])) { die('File argument not given!'); } $file = $_GET['file']; $asm = eaccelerator_dasm_file($file); if ($asm == null) { die('File not found!'); } require_once 'PHP_Highlight.php'; $h = new PHP_Highlight(); $h->loadFile($_GET['file']); $source = $h->toArray(); /* what do we need to do ? */ if (!isset($_GET['show'])) { $show = ''; } else { $show = $_GET['show']; } print_layout(); switch ($show) { case 'main': print_op_array($asm['op_array']); break; case 'functions': if (is_array($asm['functions'][$_GET['name']])) {
| at www.gnu.org/licenses/agpl.html. Removal of this | copyright header is strictly prohibited without | written permission from the original author(s). +--------------------------------------------------------*/ if (!defined("IN_FUSION")) { die("Access Denied"); } require_once INCLUDES . 'bbcodes/phphighlight/PHP_Highlight.php'; unset($matches); preg_match_all("#\\[php\\](.*?)\\[/php\\]#si", $text, $matches, PREG_PATTERN_ORDER); for ($i = 0; $i < count($matches[0]); $i++) { $input = str_replace('<br>', '', str_replace('<br />', '', str_replace('<br />', '', stripslashes($matches[1][$i])))); $search = array("\\", """, "'", "\", """, "'", "<", ">", "&"); $replace = array("\\\\", "\"", "'", "\\", "\"", "\\'", "<", ">", "&"); $input = str_replace($search, $replace, $input); $start_php = !preg_match("/<\\?php/i", $input) ? "<?php\n" : ""; $end_php = !preg_match("/\\?>/i", $input) ? "\n?>" : ""; $h = new PHP_Highlight(); $h->loadString($start_php . $input . $end_php); $parsed = $h->toList(TRUE, TRUE, FALSE); if (preg_match("/\\/forum\\//i", FUSION_REQUEST) && isset($data['post_id'])) { $php_save = "<a href='" . INCLUDES . "bbcodes/php_bbcode_save.php?thread_id=" . $_GET['thread_id'] . "&post_id=" . $data['post_id'] . "&code_id=" . $i . "'><img src='" . INCLUDES . "bbcodes/images/php_save.png' alt='" . $locale['bb_php_save'] . "' title='" . $locale['bb_php_save'] . "' style='border:none' /></a> "; } else { $php_save = ""; } $text2 = "<div class='tbl-border tbl2' style='width:400px'>" . $php_save . "<strong>" . $locale['bb_php'] . "</strong></div><div class='tbl-border tbl1' style='width:400px;height:auto;white-space:nowrap;overflow:auto;background-color:#ffffff;'>" . $parsed . "</div>"; $text = str_replace($matches[0][$i], $text2, $text); $text = str_replace("<ol>\n", "<ol>", $text); $text = str_replace("</li>\n", "</li>", $text); $text = str_replace("</ol>\n", "</ol>", $text); }
| at www.gnu.org/licenses/agpl.html. Removal of this | copyright header is strictly prohibited without | written permission from the original author(s). +--------------------------------------------------------*/ if (!defined("IN_FUSION")) { die("Access Denied"); } require_once INCLUDES . 'bbcodes/phphighlight/PHP_Highlight.php'; unset($matches); preg_match_all("#\\[php\\](.*?)\\[/php\\]#si", $text, $matches, PREG_PATTERN_ORDER); for ($i = 0; $i < count($matches[0]); $i++) { $input = str_replace('<br>', '', str_replace('<br />', '', str_replace('<br />', '', stripslashes($matches[1][$i])))); $search = array("\\", """, "'", "\", """, "'", "<", ">", "&"); $replace = array("\\\\", "\"", "'", "\\", "\"", "\\'", "<", ">", "&"); $input = str_replace($search, $replace, $input); $start_php = !preg_match("/<\\?php/i", $input) ? "<?php\n" : ""; $end_php = !preg_match("/\\?>/i", $input) ? "\n?>" : ""; $h = new PHP_Highlight(); $h->loadString($start_php . $input . $end_php); $parsed = $h->toList(true, true, false); if (preg_match("/\\/forum\\//i", FUSION_REQUEST) && isset($data['post_id'])) { $php_save = "<a href='" . INCLUDES . "bbcodes/php_bbcode_save.php?thread_id=" . $_GET['thread_id'] . "&post_id=" . $data['post_id'] . "&code_id=" . $i . "'><img src='" . INCLUDES . "bbcodes/images/php_save.png' alt='" . $locale['bb_php_save'] . "' title='" . $locale['bb_php_save'] . "' style='border:none' /></a> "; } else { $php_save = ""; } $text = preg_replace("#\\[php\\](.*?)\\[/php\\]#si", '$1', $text); $text = str_replace($matches[1][$i], "<div class='tbl-border tbl2' style='width:400px'>" . $php_save . "<strong>" . $locale['bb_php'] . "</strong></div><div class='tbl-border tbl1' style='width:400px;height:auto;white-space:nowrap;overflow:auto;background-color:#ffffff;'>" . $parsed . "</div>", $text); $text = str_replace("<ol>\n", "<ol>", $text); $text = str_replace("</li>\n", "</li>", $text); $text = str_replace("</ol>\n", "</ol>", $text); }
function highlight($string) { if (strpos($string[1], '?>') === false || strpos($string[1], '<?xml') !== false) { $result = '<code>' . $string[1] . '</code>'; } else { $highlighter = new PHP_Highlight(TRUE); $highlighter->loadString(str_replace(array('<', '>', '&', '"'), array('<', '>', '&', '"'), $string[1])); $result = str_replace(array("\r", "\n", '<code> <br /><span class="default"><?php', '?></span><br /> <br /> <br />'), array('', '', '<code><span class="default"><?php', '?></span>'), $highlighter->toHtml(TRUE, FALSE, NULL, FALSE)); } return '<pre class="programlisting">' . $result . '</pre>'; }
/** * Muestra el código fuente del archivo en formato HTML */ function mostrar() { require_once toba_dir() . "/php/3ros/PHP_Highlight.php"; $h = new PHP_Highlight(false); $h->loadFile($this->nombre); $formato_linea = "<span style='background-color:#D4D0C8; color: black; font-size: 10px;" . " padding-top: 2px; padding-right: 2px; margin-left: -4px; width: 20px; text-align: right;'>" . "%2d</span> "; $h->toHtml(false, true, $formato_linea, true); }