From: <gar...@us...> - 2003-07-08 13:51:22
|
Update of /cvsroot/php-blog/serendipity In directory sc8-pr-cvs1:/tmp/cvs-serv10839 Modified Files: comment.php serendipity_admin_image_selector.php serendipity_editor.js serendipity_functions.inc.php serendipity_lang_de.inc.php serendipity_lang_en.inc.php Added Files: serendipity_define.js.php Log Message: o Added a new file serendipity_define.js.php which can be pre-included to a javascript to set some variables. In my case I'm using it to loop the XHTML11 compliance variable to be used within the serendipity_editor.js file o Made comment.php XHTML 1.1 (optionally) compliant. o Made some more XHTML conformance entries (no 'name' attribute for forms, but 'id'. No 'target' attribute to any <a> tag. Made a serendipity_xhtml_traget() function to select which attribute to use) o Added some missing language entries. --- NEW FILE: serendipity_define.js.php --- <?php # $Id: serendipity_define.js.php,v 1.1 2003/07/08 13:51:19 garvinhicking Exp $ header('Content-type: application/x-javascript'); include_once('serendipity_config.inc.php'); ?> <!-- // Hide from older browsers // This page serves to carry through any variables without having to parse a complete .js file as .php var XHTML11 = <?php echo ($serendipity['XHTML11'] ? 'true' : 'false'); ?>; // --> <?php /* vim: set sts=4 ts=4 expandtab : */ ?> Index: comment.php =================================================================== RCS file: /cvsroot/php-blog/serendipity/comment.php,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- comment.php 8 Jul 2003 09:13:27 -0000 1.14 +++ comment.php 8 Jul 2003 13:51:19 -0000 1.15 @@ -46,10 +46,18 @@ } } else { $id = $serendipity['GET']['entry_id']; + + if ($serendipity['XHTML11']) { + echo '<?xml version="1.0" encoding="iso-8859-1" ?>' . "\n"; ?> -<html> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" + "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<?php + } +?> +<html<?php echo ($serendipity['XHTML11'] ? ' xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" dir="ltr"' : ''); ?>> <head> - <title>Comments</title> + <title><?php echo COMMENTS; ?></title> <link rel="stylesheet" type="text/css" href="<?php echo $serendipity['serendipityHTTPPath']; ?>serendipity.css.php?mode=comments" /> </head> <body> @@ -66,12 +74,12 @@ . '_' . serendipity_makeFilename($entry[0]['title']) . '.html'; ?> <div id="serendipity_bodyLevel"> - <div class="serendipity_commentsTitle">Trackbacks</div><br /> + <div class="serendipity_commentsTitle"><?php echo TRACKBACKS; ?></div><br /> <dl> - <dt><b>Trackback specific URI for this entry:</b><br /></dt> + <dt><b><?php echo TRACKBACK_SPECIFIC; ?>:</b><br /></dt> <dd><a href="<?php echo $tbu; ?>"><?php echo $tbu; ?></a><br /></dd> - <dt><b>Direct link to this entry:</b><br /></dt> + <dt><b><?php echo DIRECT_LINK; ?>:</b><br /></dt> <dd><a href="<?php echo $entry; ?>"><?php echo $entry; ?></a> <?php serendipity_printTrackbacks(serendipity_fetchTrackbacks($id)); ?> </dd> @@ -79,12 +87,12 @@ <?php } else { ?> - <div class="serendipity_commentsTitle">Comments</div> + <div class="serendipity_commentsTitle"><?php echo COMMENTS; ?></div> <?php serendipity_printComments(serendipity_fetchComments($id)); ?> - <div class="serendipity_commentsTitle">Add A Comment</div> + <div class="serendipity_commentsTitle"><?php echo ADD_COMMENT; ?></div> <?php serendipity_displayCommentForm($id); } @@ -95,15 +103,21 @@ $comment['email'] = $serendipity['POST']['email']; if ( !empty($comment['comment']) ) { serendipity_saveComment($serendipity['POST']['entry_id'], $comment, 'NORMAL'); -?> - Your comment was successfully added. - Click <a href="<?php echo $_SERVER['PHP_SELF']; ?>?serendipity[entry_id]=<?php echo $serendipity['POST']['entry_id']; ?>">here to return</a> to - the comments, and <a href="#" onClick="self.close()">here to close</a> this window. -<?php + printf( + COMMENT_ADDED, + + '<a href="' . $_SERVER['PHP_SELF'] . '?serendipity[entry_id]=' . $serendipity['POST']['entry_id'] . '">', + '</a>', + '<a href="#" onClick="self.close()">', + '</a>' + ); } else { -?> - Your comment did not contain anything, please <a href="#" onClick="history.go(-1)">go back</a> and try again -<?php + printf( + EMPTY_COMMENT, + + '<a href="#" onClick="history.go(-1)">', + '</a>' + ); } } ?> Index: serendipity_admin_image_selector.php =================================================================== RCS file: /cvsroot/php-blog/serendipity/serendipity_admin_image_selector.php,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- serendipity_admin_image_selector.php 8 Jul 2003 09:13:27 -0000 1.7 +++ serendipity_admin_image_selector.php 8 Jul 2003 13:51:19 -0000 1.8 @@ -66,7 +66,8 @@ case "1": ?> - <script src="<?php echo $serendipity['serendipityHTTPPath']; ?>serendipity_editor.js" language="Javascript" ></script> + <script type="text/javascript" language="JavaScript" src="<?php echo $serendipity['serendipityHTTPPath']; ?>serendipity_define.js.php"></script> + <script type="text/javascript" language="Javascript" src="<?php echo $serendipity['serendipityHTTPPath']; ?>serendipity_editor.js"></script> <?php $f = serendipity_parseFileName($serendipity["GET"]["image"]); echo "<img align='right' src='".$serendipity["serendipityHTTPPath"] . $serendipity["uploadPath"].$f[0].".".$serendipity["thumbSuffix"].".".$f[1]."'>"; Index: serendipity_editor.js =================================================================== RCS file: /cvsroot/php-blog/serendipity/serendipity_editor.js,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- serendipity_editor.js 8 Jul 2003 12:58:26 -0000 1.5 +++ serendipity_editor.js 8 Jul 2003 13:51:19 -0000 1.6 @@ -141,14 +141,23 @@ img = f['imgName'].value; } - if (f['serendipity[align]'][0].checked == true) { - img = "<img border='0' hspace='5' src='" + img + "' alt='' />\n"; - } else if (f['serendipity[align]'][1].checked == true) { - img = "<img border='0' hspace='5' align='left' src='" + img + "' alt='' />"; - } else if (f['serendipity[align]'][2].checked == true) { - img = "<img border='0' hspace='5' align='right' src='" + img + "' alt='' />"; + if (XHTML11) { + if (f['serendipity[align]'][0].checked == true) { + img = "<img style='border: 0px; padding-left: 5px; padding-right: 5px;' src='" + img + "' alt='' />\n"; + } else if (f['serendipity[align]'][1].checked == true) { + img = "<img style='border: 0px; padding-left: 5px; padding-right: 5px; float: left; vertical-align: top' src='" + img + "' alt='' />"; + } else if (f['serendipity[align]'][2].checked == true) { + img = "<img style='border: 0px; padding-left: 5px; padding-right: 5px; float: right; vertical-align: top' src='" + img + "' alt='' />"; + } + } else { + if (f['serendipity[align]'][0].checked == true) { + img = "<img border='0' hspace='5' src='" + img + "' alt='' />\n"; + } else if (f['serendipity[align]'][1].checked == true) { + img = "<img border='0' hspace='5' align='left' src='" + img + "' alt='' />"; + } else if (f['serendipity[align]'][2].checked == true) { + img = "<img border='0' hspace='5' align='right' src='" + img + "' alt='' />"; + } } - if (f['serendipity[isLink]'][1].checked == true) { insert = "<a href='" + f['serendipity[url]'].value + "'>" + img + "</a>"; Index: serendipity_functions.inc.php =================================================================== RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v retrieving revision 1.100 retrieving revision 1.101 diff -u -d -r1.100 -r1.101 --- serendipity_functions.inc.php 8 Jul 2003 12:05:21 -0000 1.100 +++ serendipity_functions.inc.php 8 Jul 2003 13:51:19 -0000 1.101 @@ -107,8 +107,8 @@ global $serendipity; ?> <div class="serendipityCommentForm"> - <form name="serendipity_comment" action="<?php echo $serendipity['serendipityHTTPPath']; ?>comment.php" method="post" onsubmit="if (this.serendipity_remember.checked) rememberMe(this, '<?php echo $_SERVER['HTTP_HOST']; ?>')"> - <input type="hidden" name="serendipity[entry_id]" value="<?php echo $id; ?>" /> + <form <?php echo ($serendipity['XHTML11'] ? 'id' : 'name'); ?>="serendipity_comment" action="<?php echo $serendipity['serendipityHTTPPath']; ?>comment.php" method="post" onsubmit="if (this.serendipity_remember.checked) rememberMe(this, '<?php echo $_SERVER['HTTP_HOST']; ?>')"> + <div><input type="hidden" name="serendipity[entry_id]" value="<?php echo $id; ?>" /></div> <table border="0" width="100%" cellpadding="3"> <tr> @@ -132,12 +132,12 @@ </tr> </table> - <?php echo REMEMBER_INFO; ?> - - <input type="checkbox" name="serendipity[remember]" <?php echo $serendipity['COOKIE']['remember'] ; ?> /><br /> - <input type="submit" value="<?php echo SUBMIT_COMMENT; ?>" /> + <div> + <span class="serendipity_comment_source" style="vertical-align: middle"><?php echo REMEMBER_INFO; ?></span> + <input type="checkbox" name="serendipity[remember]" <?php echo $serendipity['COOKIE']['remember'] ; ?> /><br /> + <input type="submit" value="<?php echo SUBMIT_COMMENT; ?>" /> + </div> </form> -</div> <?php } @@ -493,7 +493,7 @@ $html_extended = ''; if ($extended && strlen($entry['extended'])) { - $html_extended = '<a name="#extended"></a>'; + $html_extended = '<a ' . ($serendipity['XHTML11'] ? 'id' : 'name') . '="#extended"></a>'; $html_extended .= nl2br(serendipity_emoticate(serendipity_markup_text($entry['extended'], $entry['id']))); } @@ -652,7 +652,7 @@ ?> <tr> <td class="serendipity_comment"> - <a name="c<?php echo $comment['id']; ?>"></a> + <a <?php echo ($serendipity['XHTML11'] ? 'id' : 'name'); ?>="c<?php echo $comment['id']; ?>"></a> <?php echo nl2br(serendipity_markup_text(serendipity_emoticate($body))); ?><br /> <div class="serendipity_comment_source"> @@ -660,14 +660,14 @@ <?php /* Link to the user's email */ if ( !empty($comment['email']) ) { - echo '<a href="mailto:' . htmlentities($comment['email']) . '" title="' . SEND_MAIL_TO . '" ' . htmlentities($name) . '(' . $comment['email'] . ')">' . htmlentities($name) . '</a>'; + echo '<a href="mailto:' . htmlentities($comment['email']) . '" title="' . SEND_MAIL_TO . ' ' . htmlentities($name) . '(' . $comment['email'] . ')">' . htmlentities($name) . '</a>'; } else { echo htmlentities($name); } /* Link to the user's website, if the URL is valid */ if ( $comment['type'] != 'trackback' && !empty($comment['url']) && $comment['url'] != 'http://' && eregi('^http://', $comment['url']) ) { - echo ' (<a href="' . str_replace('"', '"', $comment['url']) . '" target="_blank" title="' . htmlentities($comment['url']) . '">Link</a>)'; + echo ' (<a href="' . str_replace('"', '"', $comment['url']) . '" ' . serendipity_xhtml_target('_blank') . ' title="' . htmlentities($comment['url']) . '">Link</a>)'; } /* Show when the entry was made */ @@ -712,7 +712,7 @@ ?> <tr> <td class="serendipity_comment"> - <a href="<?php echo strip_tags($link); ?>" target="_blank"><?php echo $title; ?></a><br /> + <a href="<?php echo strip_tags($link); ?>" <?php echo serendipity_xhtml_target('_blank'); ?>><?php echo $title; ?></a><br /> <b><?php echo EXCERPT; ?>: </b> <?php echo htmlentities(strip_tags($comment['body'])); ?><br /> <div class="serendipity_comment_source"> @@ -1531,7 +1531,7 @@ $hidden .= ' <input type="hidden" name="serendipity[timestamp]" value="' . $entry['timestamp'] . '" />' . $n; ?> <span style="color: #FF0000;"><?php echo $errMsg; ?></span> - <form action="<?php echo $targetURL; ?>" method="post" name="serendipityEntry" style="margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px"> + <form action="<?php echo $targetURL; ?>" method="post" <?php echo ($serendipity['XHTML11'] ? 'id' : 'name'); ?>="serendipityEntry" style="margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px"> <?php echo $hidden; ?> <table class="serendipityEntryEdit"> @@ -1611,6 +1611,7 @@ serendipity_emit_htmlarea_code('document.forms[\'serendipityEntry\'][\'serendipity[body]\']'); serendipity_emit_htmlarea_code('document.forms[\'serendipityEntry\'][\'serendipity[extended]\']'); } else { + echo ' <script type="text/javascript" language="JavaScript" src="serendipity_define.js.php"></script>'; echo ' <script type="text/javascript" language="JavaScript" src="serendipity_editor.js"></script>'; } } @@ -1915,6 +1916,17 @@ ?> </table> <?php +} + +function serendipity_xhtml_target($target) +{ + global $serendipity; + + if ($serendipity['XHTML11']) { + return ' onclick="window.open(this.href, \'target' . time() . '\'); return false;" '; + } else { + return ' target="' . $target . '" '; + } } define("serendipity_FUNCTIONS_LOADED", true); Index: serendipity_lang_de.inc.php =================================================================== RCS file: /cvsroot/php-blog/serendipity/serendipity_lang_de.inc.php,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- serendipity_lang_de.inc.php 8 Jul 2003 09:13:27 -0000 1.13 +++ serendipity_lang_de.inc.php 8 Jul 2003 13:51:19 -0000 1.14 @@ -75,6 +75,7 @@ define('MANAGE_IMAGES', 'Bilder verwalten'); define('ADMIN_INTERFACE', 'Verwaltungsoberfläche'); define('SERENDIPITY_AUTHORING_SUITE', 'Serendipity Autorenoberfläche'); +define('AUTHOR_SUITE', 'Serendipity Autorenoberfläche'); define('NAME', 'Name'); define('EMAIL', 'Email'); define('HOMEPAGE', 'Homepage'); @@ -158,13 +159,17 @@ define('EXCERPT', 'Auszug'); define('TRACKED', 'Aufgenommen'); define('LINK_TO_ENTRY', 'Link zum Eintrag'); -define('LINK_TO_REMOTE_ENTRY', 'Link to remote-entry'); +define('LINK_TO_REMOTE_ENTRY', 'Link zum Remote-Eintrag'); define('IP_ADDRESS', 'IP-Adresse'); define('USER', 'Benutzer'); define('THUMBNAIL_USING_OWN', 'Using %s as it\'s own thumbnail because it is so small already.'); define('THUMBNAIL_FAILED_COPY', 'Wanted to use %s as it\'s own thumbnail, but failed to copy!'); define('AUTHOR', 'Author'); define('LAST_UPDATED', 'Zuletzt aktualisiert'); +define('TRACKBACK_SPECIFIC', 'Trackback für spezifische URI dieses Eintrags'); +define('DIRECT_LINK', 'Direkter Link zu diesem Eintrag'); +define('COMMENT_ADDED', 'Dein Kommentar wurde hinzugefügt. Klick %shier um zu den Kommentaren zurückzukehren%s und %shier um das Fenster zu schließen%s.'); +define('EMPTY_COMMENT', 'Dein Kommentar enthielt nichts, bitte %sgeh zurück%s und versuch\'s nochmal'); define('serendipity_LANG_LOADED', true); /* vim: set sts=4 ts=4 expandtab : */ Index: serendipity_lang_en.inc.php =================================================================== RCS file: /cvsroot/php-blog/serendipity/serendipity_lang_en.inc.php,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- serendipity_lang_en.inc.php 8 Jul 2003 09:13:27 -0000 1.17 +++ serendipity_lang_en.inc.php 8 Jul 2003 13:51:19 -0000 1.18 @@ -159,13 +159,17 @@ define('EXCERPT', 'Excerpt'); define('TRACKED', 'Tracked'); define('LINK_TO_ENTRY', 'Link to entry'); -define('LINK_TO_REMOTE_ENTRY', 'Link zum Remote-Eintrag'); +define('LINK_TO_REMOTE_ENTRY', 'Link to remote-entry'); define('IP_ADDRESS', 'IP-address'); define('USER', 'User'); define('THUMBNAIL_USING_OWN', 'Using %s as it\'s own thumbnail because it is so small already.'); define('THUMBNAIL_FAILED_COPY', 'Wanted to use %s as it\'s own thumbnail, but failed to copy!'); define('AUTHOR', 'Author'); define('LAST_UPDATED', 'Last Updated'); +define('TRACKBACK_SPECIFIC', 'Trackback specific URI for this entry'); +define('DIRECT_LINK', 'Direct link to this entry'); +define('COMMENT_ADDED', 'Your comment was successfully added. Click %shere to return%s to the comments, and %shere to close%s this window.'); +define('EMPTY_COMMENT', 'Your comment did not contain anything, please %sgo back%s and try again'); define('serendipity_LANG_LOADED', true); /* vim: set sts=4 ts=4 expandtab : */ |