• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythonwindowsphpgamebathyscaphegui翻訳comegattwitterframeworkbtronvb.net計画中(planning stage)testdomarduinodirectxpreviewerゲームエンジン

Commit MetaInfo

Revisionda694039bf553fe9cdfe3fc0fe5cc5ccd5a75635 (tree)
Time2014-11-29 19:21:30
Authorhenoheno <henoheno>
Commiterumorigu

Log Message

do_update_diff(): Simplify. Beautify XHTML

Change Summary

Incremental Difference

--- a/lib/diff.php
+++ b/lib/diff.php
@@ -2,7 +2,7 @@
22 // PukiWiki - Yet another WikiWikiWeb clone.
33 // $Id: diff.php,v 1.10 2011/01/25 15:01:01 henoheno Exp $
44 // Copyright (C)
5-// 2003-2005 PukiWiki Developers Team
5+// 2003-2005, 2007 PukiWiki Developers Team
66 // 2001-2002 Originally written by yu-ji
77 // License: GPL v2 or (at your option) any later version
88 //
@@ -47,8 +47,8 @@ function do_update_diff($pagestr, $poststr, $original)
4747
4848 if (PKWK_DIFF_SHOW_CONFLICT_DETAIL) {
4949 global $do_update_diff_table;
50-
51- $do_update_diff_table = <<<EOD
50+ $table = array();
51+ $table[] = <<<EOD
5252 <p>l : between backup data and stored page data.<br />
5353 r : between backup data and your post data.</p>
5454 <table class="style_table">
@@ -60,29 +60,32 @@ function do_update_diff($pagestr, $poststr, $original)
6060 EOD;
6161 $tags = array('th', 'th', 'td');
6262 foreach ($arr as $_obj) {
63- $do_update_diff_table .= '<tr>';
63+ $table[] = ' <tr>';
6464 $params = array($_obj->get('left'), $_obj->get('right'), $_obj->text());
65- foreach ($params as $key=>$text) {
66- $text = htmlsc($text);
67- if (trim($text) == '') $text = '&nbsp;';
68- $do_update_diff_table .= '<' . $tags[$key] .
69- ' class="style_' . $tags[$key] . '">' . $text .
65+ foreach ($params as $key => $text) {
66+ $text = htmlsc(rtrim($text));
67+ if (empty($text)) $text = '&nbsp;';
68+ $table[] =
69+ ' <' . $tags[$key] . ' class="style_' . $tags[$key] . '">' .
70+ $text .
7071 '</' . $tags[$key] . '>';
7172 }
72- $do_update_diff_table .= '</tr>' . "\n";
73+ $table[] = ' </tr>';
7374 }
74- $do_update_diff_table .= '</table>' . "\n";
75+ $table[] = '</table>';
76+
77+ $do_update_diff_table = implode("\n", $table) . "\n";
78+ unset($table);
7579 }
7680
77- $body = '';
81+ $body = array();
7882 foreach ($arr as $_obj) {
79- if ($_obj->get('left') != '-' && $_obj->get('right') != '-')
80- $body .= $_obj->text();
83+ if ($_obj->get('left') != '-' && $_obj->get('right') != '-') {
84+ $body[] = $_obj->text();
85+ }
8186 }
8287
83- $auto = 1;
84-
85- return array(rtrim($body) . "\n", $auto);
88+ return array(rtrim(implode('', $body)) . "\n", 1);
8689 }
8790
8891