[geeklog-cvs] geeklog: Allow switching the DOCTYPE from the Configuration. Req...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sat Mar 21 18:35:32 EDT 2009
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/b68c7068c056
changeset: 6848:b68c7068c056
user: Dirk Haun <dirk at haun-online.de>
date: Sat Mar 21 23:32:53 2009 +0100
description:
Allow switching the DOCTYPE from the Configuration. Requires a theme that uses {doctype} instead of a hard-coded DOCTYPE declaration (feature request #0000745)
diffstat:
15 files changed, 86 insertions(+), 19 deletions(-)
language/english.php | 4 +
language/english_utf-8.php | 4 +
language/german.php | 4 +
language/german_formal.php | 4 +
language/german_formal_utf-8.php | 4 +
language/german_utf-8.php | 4 +
public_html/admin/install/config-install.php | 1
public_html/docs/config.html | 8 +++
public_html/docs/history | 3 +
public_html/docs/theme.html | 6 ++
public_html/layout/professional/functions.php | 4 -
public_html/layout/professional/header.thtml | 2
public_html/lib-common.php | 51 +++++++++++++++++++++----
sql/updates/mssql_1.5.2_to_1.6.0.php | 3 +
sql/updates/mysql_1.5.2_to_1.6.0.php | 3 +
diffs (truncated from 325 to 300 lines):
diff -r a8037a55dbd6 -r b68c7068c056 language/english.php
--- a/language/english.php Sat Mar 21 19:09:10 2009 +0100
+++ b/language/english.php Sat Mar 21 23:32:53 2009 +0100
@@ -1627,6 +1627,7 @@
'mysqldump_options' => "MySQL Dump Options",
'mysqldump_filename_mask' => 'Backup File Name Mask',
'theme' => "Theme",
+ 'doctype' => 'DOCTYPE Declaration',
'menu_elements' => "Menu Elements",
'path_themes' => "Themes Path",
'disable_new_user_registration' => "Disable New Registrations",
@@ -1889,7 +1890,8 @@
17 => array('Comments Enabled' => 0, 'Comments Disabled' => -1),
18 => array('Disabled' => 0, 'Enabled (Exact Match)' => 1, 'Enabled (Word Beginning)' => 2, 'Enabled (Word Fragment)' => 3),
19 => array('Google' => 'google', 'Table' => 'table'),
- 20 => array('Exact Phrase' => 'phrase', 'All of The Words' => 'all', 'Any of The Words' => 'any')
+ 20 => array('Exact Phrase' => 'phrase', 'All of The Words' => 'all', 'Any of The Words' => 'any'),
+ 21 => array('HTML 4.01 Transitional' => 'html401transitional', 'HTML 4.01 Strict' => 'html401strict', 'XHTML 1.0 Transitional' => 'xhtml10transitional', 'XHTML 1.0 Strict' => 'xhtml10strict', '(hard-coded in theme)' => '')
);
?>
diff -r a8037a55dbd6 -r b68c7068c056 language/english_utf-8.php
--- a/language/english_utf-8.php Sat Mar 21 19:09:10 2009 +0100
+++ b/language/english_utf-8.php Sat Mar 21 23:32:53 2009 +0100
@@ -1627,6 +1627,7 @@
'mysqldump_options' => "MySQL Dump Options",
'mysqldump_filename_mask' => 'Backup File Name Mask',
'theme' => "Theme",
+ 'doctype' => 'DOCTYPE Declaration',
'menu_elements' => "Menu Elements",
'path_themes' => "Themes Path",
'disable_new_user_registration' => "Disable New Registrations",
@@ -1889,7 +1890,8 @@
17 => array('Comments Enabled' => 0, 'Comments Disabled' => -1),
18 => array('Disabled' => 0, 'Enabled (Exact Match)' => 1, 'Enabled (Word Beginning)' => 2, 'Enabled (Word Fragment)' => 3),
19 => array('Google' => 'google', 'Table' => 'table'),
- 20 => array('Exact Phrase' => 'phrase', 'All of The Words' => 'all', 'Any of The Words' => 'any')
+ 20 => array('Exact Phrase' => 'phrase', 'All of The Words' => 'all', 'Any of The Words' => 'any'),
+ 21 => array('HTML 4.01 Transitional' => 'html401transitional', 'HTML 4.01 Strict' => 'html401strict', 'XHTML 1.0 Transitional' => 'xhtml10transitional', 'XHTML 1.0 Strict' => 'xhtml10strict', '(hard-coded in theme)' => '')
);
?>
diff -r a8037a55dbd6 -r b68c7068c056 language/german.php
--- a/language/german.php Sat Mar 21 19:09:10 2009 +0100
+++ b/language/german.php Sat Mar 21 23:32:53 2009 +0100
@@ -1629,6 +1629,7 @@
'mysqldump_options' => 'MySQL Dump Optionen',
'mysqldump_filename_mask' => 'Backup File Name Mask',
'theme' => 'Theme',
+ 'doctype' => 'DOCTYPE Declaration',
'menu_elements' => 'Elemente des Menüs ',
'path_themes' => 'Pfad zu Themes',
'disable_new_user_registration' => 'Registrieren neuer User abschalten',
@@ -1884,7 +1885,8 @@
17 => array('Kommentare eingeschaltet' => 0, 'Kommentare ausgeschaltet' => -1),
18 => array('Aus' => 0, 'Ein (Exakte Übereinstimmung)' => 1, 'Ein (Wortanfang)' => 2, 'Ein (Teilwort)' => 3),
19 => array('Google' => 'google', 'Table' => 'table'),
- 20 => array('Exact Phrase' => 'phrase', 'All of The Words' => 'all', 'Any of The Words' => 'any')
+ 20 => array('Exact Phrase' => 'phrase', 'All of The Words' => 'all', 'Any of The Words' => 'any'),
+ 21 => array('HTML 4.01 Transitional' => 'html401transitional', 'HTML 4.01 Strict' => 'html401strict', 'XHTML 1.0 Transitional' => 'xhtml10transitional', 'XHTML 1.0 Strict' => 'xhtml10strict', '(hard-coded in theme)' => '')
);
?>
diff -r a8037a55dbd6 -r b68c7068c056 language/german_formal.php
--- a/language/german_formal.php Sat Mar 21 19:09:10 2009 +0100
+++ b/language/german_formal.php Sat Mar 21 23:32:53 2009 +0100
@@ -1630,6 +1630,7 @@
'mysqldump_options' => 'MySQL Dump Optionen',
'mysqldump_filename_mask' => 'Backup File Name Mask',
'theme' => 'Theme',
+ 'doctype' => 'DOCTYPE Declaration',
'menu_elements' => 'Elemente des Menüs ',
'path_themes' => 'Pfad zu Themes',
'disable_new_user_registration' => 'Registrieren neuer User abschalten',
@@ -1885,7 +1886,8 @@
17 => array('Kommentare eingeschaltet' => 0, 'Kommentare ausgeschaltet' => -1),
18 => array('Aus' => 0, 'Ein (Exakte Übereinstimmung)' => 1, 'Ein (Wortanfang)' => 2, 'Ein (Teilwort)' => 3),
19 => array('Google' => 'google', 'Table' => 'table'),
- 20 => array('Exact Phrase' => 'phrase', 'All of The Words' => 'all', 'Any of The Words' => 'any')
+ 20 => array('Exact Phrase' => 'phrase', 'All of The Words' => 'all', 'Any of The Words' => 'any'),
+ 21 => array('HTML 4.01 Transitional' => 'html401transitional', 'HTML 4.01 Strict' => 'html401strict', 'XHTML 1.0 Transitional' => 'xhtml10transitional', 'XHTML 1.0 Strict' => 'xhtml10strict', '(hard-coded in theme)' => '')
);
?>
diff -r a8037a55dbd6 -r b68c7068c056 language/german_formal_utf-8.php
--- a/language/german_formal_utf-8.php Sat Mar 21 19:09:10 2009 +0100
+++ b/language/german_formal_utf-8.php Sat Mar 21 23:32:53 2009 +0100
@@ -1630,6 +1630,7 @@
'mysqldump_options' => 'MySQL Dump Optionen',
'mysqldump_filename_mask' => 'Backup File Name Mask',
'theme' => 'Theme',
+ 'doctype' => 'DOCTYPE Declaration',
'menu_elements' => 'Elemente des Menüs ',
'path_themes' => 'Pfad zu Themes',
'disable_new_user_registration' => 'Registrieren neuer User abschalten',
@@ -1885,7 +1886,8 @@
17 => array('Kommentare eingeschaltet' => 0, 'Kommentare ausgeschaltet' => -1),
18 => array('Aus' => 0, 'Ein (Exakte Ãbereinstimmung)' => 1, 'Ein (Wortanfang)' => 2, 'Ein (Teilwort)' => 3),
19 => array('Google' => 'google', 'Table' => 'table'),
- 20 => array('Exact Phrase' => 'phrase', 'All of The Words' => 'all', 'Any of The Words' => 'any')
+ 20 => array('Exact Phrase' => 'phrase', 'All of The Words' => 'all', 'Any of The Words' => 'any'),
+ 21 => array('HTML 4.01 Transitional' => 'html401transitional', 'HTML 4.01 Strict' => 'html401strict', 'XHTML 1.0 Transitional' => 'xhtml10transitional', 'XHTML 1.0 Strict' => 'xhtml10strict', '(hard-coded in theme)' => '')
);
?>
diff -r a8037a55dbd6 -r b68c7068c056 language/german_utf-8.php
--- a/language/german_utf-8.php Sat Mar 21 19:09:10 2009 +0100
+++ b/language/german_utf-8.php Sat Mar 21 23:32:53 2009 +0100
@@ -1629,6 +1629,7 @@
'mysqldump_options' => 'MySQL Dump Optionen',
'mysqldump_filename_mask' => 'Backup File Name Mask',
'theme' => 'Theme',
+ 'doctype' => 'DOCTYPE Declaration',
'menu_elements' => 'Elemente des Menüs ',
'path_themes' => 'Pfad zu Themes',
'disable_new_user_registration' => 'Registrieren neuer User abschalten',
@@ -1884,7 +1885,8 @@
17 => array('Kommentare eingeschaltet' => 0, 'Kommentare ausgeschaltet' => -1),
18 => array('Aus' => 0, 'Ein (Exakte Ãbereinstimmung)' => 1, 'Ein (Wortanfang)' => 2, 'Ein (Teilwort)' => 3),
19 => array('Google' => 'google', 'Table' => 'table'),
- 20 => array('Exact Phrase' => 'phrase', 'All of The Words' => 'all', 'Any of The Words' => 'any')
+ 20 => array('Exact Phrase' => 'phrase', 'All of The Words' => 'all', 'Any of The Words' => 'any'),
+ 21 => array('HTML 4.01 Transitional' => 'html401transitional', 'HTML 4.01 Strict' => 'html401strict', 'XHTML 1.0 Transitional' => 'xhtml10transitional', 'XHTML 1.0 Strict' => 'xhtml10strict', '(hard-coded in theme)' => '')
);
?>
diff -r a8037a55dbd6 -r b68c7068c056 public_html/admin/install/config-install.php
--- a/public_html/admin/install/config-install.php Sat Mar 21 19:09:10 2009 +0100
+++ b/public_html/admin/install/config-install.php Sat Mar 21 23:32:53 2009 +0100
@@ -139,6 +139,7 @@
$c->add('fs_theme', NULL, 'fieldset', 2, 10, NULL, 0, TRUE);
$c->add('theme','professional','select',2,10,NULL,190,TRUE);
+ $c->add('doctype','html401strict','select',2,10,21,195,TRUE);
$c->add('menu_elements',array('contribute','search','stats','directory','plugins'),'%text',2,10,NULL,200,TRUE);
$c->add('path_themes','','text',2,10,NULL,210,TRUE);
diff -r a8037a55dbd6 -r b68c7068c056 public_html/docs/config.html
--- a/public_html/docs/config.html Sat Mar 21 19:09:10 2009 +0100
+++ b/public_html/docs/config.html Sat Mar 21 23:32:53 2009 +0100
@@ -505,6 +505,14 @@
<td valign="top">professional</td>
<td valign="top">Default theme to use on the site</td></tr>
<tr>
+ <td valign="top"><a name="desc_doctype">doctype</a></td>
+ <td valign="top">HTML 4.01 Strict</td>
+ <td valign="top"><a
+ href="http://en.wikipedia.org/wiki/Document_Type_Declaration">Document Type
+ Declaration</a> (aka DOCTYPE aka DTD) to use for all the themes on your
+ site, assuming they use the <tt>{doctype}</tt> variable instead of a
+ hard-coded DOCTYPE in their <tt>header.thtml</tt>.</td></tr>
+<tr>
<td valign="top"><a name="desc_menu_elements">menu_elements</a></td>
<td valign="top"><code>array('contribute', 'calendar', 'search', 'stats',
'directory', 'plugins')</code></td>
diff -r a8037a55dbd6 -r b68c7068c056 public_html/docs/history
--- a/public_html/docs/history Sat Mar 21 19:09:10 2009 +0100
+++ b/public_html/docs/history Sat Mar 21 23:32:53 2009 +0100
@@ -11,6 +11,9 @@
+ (TBD) Comment moderation and editable comments, by Jared Wenerd
Other changes:
+- Allow switching the DOCTYPE from the Configuration. Requires a theme that
+ uses {doctype} instead of a hard-coded DOCTYPE declaration (feature request
+ #0000745) [Dirk]
- The notification email about new user submissions didn't include information
about the remote service used (if any) [Dirk]
- Define {xmlns} when using XHTML for XHTML compliance. Updated header.thtml
diff -r a8037a55dbd6 -r b68c7068c056 public_html/docs/theme.html
--- a/public_html/docs/theme.html Sat Mar 21 19:09:10 2009 +0100
+++ b/public_html/docs/theme.html Sat Mar 21 23:32:53 2009 +0100
@@ -198,6 +198,12 @@
<h2><a name="changes">Theme changes in Geeklog 1.6.0</a></h2>
<ul>
+<li>Themes can now opt to use a <tt>{doctype}</tt> variable in their
+ <tt>header.thtml</tt> instead of using a hard-coded DOCTYPE declaration.
+ The DOCTYPE will then be set from the configuration (currently available:
+ HTML 4.01 Strict and Transitional, XHTML 1.0 Strict and Transitional). Such
+ a theme should <em>not</em> set the <code>XHTML</code> constant in its
+ <tt>functions.php</tt> file!</li>
<li>When using <a href="#xhtml">XHTML</a>, the variable <tt>{xmlns}</tt> now
contains <tt>xmlns="http://www.w3.org/1999/xhtml"</tt> for XHTML compliance
(to be used in the <tt><html></tt> element).</li>
diff -r a8037a55dbd6 -r b68c7068c056 public_html/layout/professional/functions.php
--- a/public_html/layout/professional/functions.php Sat Mar 21 19:09:10 2009 +0100
+++ b/public_html/layout/professional/functions.php Sat Mar 21 23:32:53 2009 +0100
@@ -6,10 +6,6 @@
}
$_IMAGE_TYPE = 'png';
-
-if (!defined('XHTML')) {
- define('XHTML', ''); // change this to ' /' for XHTML
-}
/*
* For left/right block support there is no longer any need for the theme to
diff -r a8037a55dbd6 -r b68c7068c056 public_html/layout/professional/header.thtml
--- a/public_html/layout/professional/header.thtml Sat Mar 21 19:09:10 2009 +0100
+++ b/public_html/layout/professional/header.thtml Sat Mar 21 23:32:53 2009 +0100
@@ -1,4 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+{doctype}
<html{lang_attribute}{xmlns}>
<head>
<title>{page_title_and_site_name}</title>
diff -r a8037a55dbd6 -r b68c7068c056 public_html/lib-common.php
--- a/public_html/lib-common.php Sat Mar 21 19:09:10 2009 +0100
+++ b/public_html/lib-common.php Sat Mar 21 23:32:53 2009 +0100
@@ -302,7 +302,16 @@
// ensure XHTML constant is defined to avoid problems elsewhere
if (!defined('XHTML')) {
- define('XHTML', '');
+ switch ($_CONF['doctype']) {
+ case 'xhtml10transitional':
+ case 'xhtml10strict':
+ define('XHTML', ' /');
+ break;
+
+ default:
+ define('XHTML', '');
+ break;
+ }
}
// themes can now specify the default image type
@@ -832,11 +841,33 @@
return $function( $what, $pagetitle, $headercode );
}
- // send out the charset header
- header( 'Content-Type: text/html; charset=' . COM_getCharset());
-
// If we reach here then either we have the default theme OR
// the current theme only needs the default variable substitutions
+
+ switch ($_CONF['doctype']) {
+ case 'html401transitional':
+ $doctype = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
+ break;
+
+ case 'html401strict':
+ $doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">';
+ break;
+
+ case 'xhtml10transitional':
+ $doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
+ break;
+
+ case 'xhtml10strict':
+ $doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
+ break;
+
+ default: // fallback: HTML 4.01 Transitional w/o system identifier
+ $doctype = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
+ break;
+ }
+
+ // send out the charset header
+ header('Content-Type: text/html; charset=' . COM_getCharset());
$header = new Template( $_CONF['path_layout'] );
$header->set_file( array(
@@ -847,8 +878,11 @@
'leftblocks' => 'leftblocks.thtml',
'rightblocks' => 'rightblocks.thtml'
));
+ $header->set_var('doctype', $doctype);
$header->set_var('xhtml', XHTML);
- if (XHTML != '') {
+ if (XHTML == '') {
+ $header->set_var('xmlns', '');
+ } else {
$header->set_var('xmlns', ' xmlns="http://www.w3.org/1999/xhtml"');
}
@@ -2153,7 +2187,7 @@
{
$imageurl = COM_getTopicImageUrl( $A['imageurl'] );
$topicimage = '<img src="' . $imageurl . '" alt="' . $topicname
- . '" title="' . $topicname . '" border="0"' . XHTML . '>';
+ . '" title="' . $topicname . '"' . XHTML . '>';
}
$sections->set_var( 'topic_image', $topicimage );
@@ -4734,8 +4768,9 @@
if( !empty( $A['photo'] ) AND $_CONF['allow_user_photo'] == 1)
{
- $usrimg = '<img src="' . $_CONF['layout_url'] . '/images/smallcamera.'
- . $_IMAGE_TYPE . '" border="0" alt=""' . XHTML . '>';
+ $usrimg = '<img src="' . $_CONF['layout_url']
+ . '/images/smallcamera.' . $_IMAGE_TYPE
+ . '" alt=""' . XHTML . '>';
$retval .= ' ' . COM_createLink($usrimg, $url);
}
$retval .= '<br' . XHTML . '>';
diff -r a8037a55dbd6 -r b68c7068c056 sql/updates/mssql_1.5.2_to_1.6.0.php
More information about the geeklog-cvs
mailing list