diff options
| author | Max Kremmel <xing@synapse.plus.com> | 2006-09-11 06:50:51 +0000 |
|---|---|---|
| committer | Max Kremmel <xing@synapse.plus.com> | 2006-09-11 06:50:51 +0000 |
| commit | c553f10b2da0b56e3e1d0c055ea7e45731dfe305 (patch) | |
| tree | 1679089de17da63ec09a7e4393df3356010c70d3 | |
| parent | ee58685c86a23647b058f016798109214879e5f8 (diff) | |
| download | liberty-c553f10b2da0b56e3e1d0c055ea7e45731dfe305.tar.gz liberty-c553f10b2da0b56e3e1d0c055ea7e45731dfe305.tar.bz2 liberty-c553f10b2da0b56e3e1d0c055ea7e45731dfe305.zip | |
fix tables for guests viewing 'create page' links starting numerically within a table - very odd bug...
| -rw-r--r-- | plugins/format.tikiwiki.php | 103 |
1 files changed, 53 insertions, 50 deletions
diff --git a/plugins/format.tikiwiki.php b/plugins/format.tikiwiki.php index 7da7791..a04a717 100644 --- a/plugins/format.tikiwiki.php +++ b/plugins/format.tikiwiki.php @@ -1,6 +1,6 @@ <?php /** - * @version $Revision: 1.62 $ + * @version $Revision: 1.63 $ * @package liberty */ global $gLibertySystem; @@ -1057,8 +1057,11 @@ class TikiWikiParser extends BitBase { } else { $repl = BitPage::getDisplayLink( $page_parse, $exists ); } - $slashedParse = preg_replace( "/([\/\[\]\(\)])/", "\\\\$1", $page_parse ); - $data = preg_replace("/([ \n\t\r\,\;]|^)".$slashedParse."($|[ \n\t\r\,\;\.])/", "$1"."$repl"."$2", $data); + // use preg_quote instead + //$slashedParse = preg_replace( "/([\/\[\]\(\)])/", "\\\\$1", $page_parse ); + // not sure why this is here - it breaks numeric 'create page' links in tables + //$data = preg_replace("/([ \n\t\r\,\;]|^)".$slashedParse."($|[ \n\t\r\,\;\.])/", "$1"."$repl"."$2", $data); + $data = preg_replace( "/".preg_quote( $page_parse, "/" )."/", $repl, $data); //$data = str_replace($page_parse,$repl,$data); } } @@ -1138,43 +1141,43 @@ class TikiWikiParser extends BitBase { $cols = array(); for ($i = 0; $i < count($tables[0]); $i++) { - $rows = explode('||', $tables[0][$i]); + $rows = explode('||', $tables[0][$i]); - $col[$i] = array(); + $col[$i] = array(); - for ($j = 0; $j < count($rows); $j++) { - $cols[$i][$j] = explode('|', $rows[$j]); + for ($j = 0; $j < count($rows); $j++) { + $cols[$i][$j] = explode('|', $rows[$j]); - if (count($cols[$i][$j]) > $maxcols) - $maxcols = count($cols[$i][$j]); - } + if (count($cols[$i][$j]) > $maxcols) + $maxcols = count($cols[$i][$j]); + } } for ($i = 0; $i < count($tables[0]); $i++) { - $repl = '<table class="bittable">'; + $repl = '<table class="bittable">'; - for ($j = 0; $j < count($cols[$i]); $j++) { - $ncols = count($cols[$i][$j]); + for ($j = 0; $j < count($cols[$i]); $j++) { + $ncols = count($cols[$i][$j]); - if ($ncols == 1 && !$cols[$i][$j][0]) - continue; + if ($ncols == 1 && !$cols[$i][$j][0]) + continue; - $repl .= '<tr class="'.( ( $j % 2 ) ? 'even' : 'odd' ).'">'; + $repl .= '<tr class="'.( ( $j % 2 ) ? 'even' : 'odd' ).'">'; - for ($k = 0; $k < $ncols; $k++) { - $repl .= '<td '; + for ($k = 0; $k < $ncols; $k++) { + $repl .= '<td '; - if ($k == $ncols - 1 && $ncols < $maxcols) - $repl .= ' colspan="' . ($maxcols - $k).'"'; + if ($k == $ncols - 1 && $ncols < $maxcols) + $repl .= ' colspan="' . ($maxcols - $k).'"'; - $repl .= '>' . $cols[$i][$j][$k] . '</td>'; - } + $repl .= '>' . $cols[$i][$j][$k] . '</td>'; + } - $repl .= '</tr>'; - } + $repl .= '</tr>'; + } - $repl .= '</table>'; - $data = str_replace($tables[0][$i], $repl, $data); + $repl .= '</table>'; + $data = str_replace($tables[0][$i], $repl, $data); } } } else { @@ -1186,42 +1189,42 @@ class TikiWikiParser extends BitBase { $cols = array(); for ($i = 0; $i < count($tables[0]); $i++) { - $rows = split("\n|\<br\/\>", $tables[0][$i]); - $col[$i] = array(); + $rows = split("\n|\<br\/\>", $tables[0][$i]); + $col[$i] = array(); - for ($j = 0; $j < count($rows); $j++) { - $rows[$j] = str_replace('||', '', $rows[$j]); - $cols[$i][$j] = explode('|', $rows[$j]); - if (count($cols[$i][$j]) > $maxcols) - $maxcols = count($cols[$i][$j]); - } + for ($j = 0; $j < count($rows); $j++) { + $rows[$j] = str_replace('||', '', $rows[$j]); + $cols[$i][$j] = explode('|', $rows[$j]); + if (count($cols[$i][$j]) > $maxcols) + $maxcols = count($cols[$i][$j]); + } } for ($i = 0; $i < count($tables[0]); $i++) { - $repl = '<table class="bittable">'; + $repl = '<table class="bittable">'; - for ($j = 0; $j < count($cols[$i]); $j++) { - $ncols = count($cols[$i][$j]); + for ($j = 0; $j < count($cols[$i]); $j++) { + $ncols = count($cols[$i][$j]); - if ($ncols == 1 && !$cols[$i][$j][0]) - continue; + if ($ncols == 1 && !$cols[$i][$j][0]) + continue; - $repl .= '<tr class="'.( ( $j % 2 ) ? 'even' : 'odd' ).'">'; + $repl .= '<tr class="'.( ( $j % 2 ) ? 'even' : 'odd' ).'">'; - for ($k = 0; $k < $ncols; $k++) { - $repl .= '<td '; + for ($k = 0; $k < $ncols; $k++) { + $repl .= '<td '; - if ($k == $ncols - 1 && $ncols < $maxcols) - $repl .= ' colspan="' . ($maxcols - $k).'"'; + if ($k == $ncols - 1 && $ncols < $maxcols) + $repl .= ' colspan="' . ($maxcols - $k).'"'; - $repl .= '>' . $cols[$i][$j][$k] . '</td>'; - } + $repl .= '>' . $cols[$i][$j][$k] . '</td>'; + } - $repl .= '</tr>'; - } + $repl .= '</tr>'; + } - $repl .= '</table>'; - $data = str_replace($tables[0][$i], $repl, $data); + $repl .= '</table>'; + $data = str_replace($tables[0][$i], $repl, $data); } } } |
