[geeklog-cvs] geeklog: Fixed "Undefind constant XHTML" by implementing a minim...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sun Apr 15 09:20:15 EDT 2012


changeset 8593:f0455add3e06
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/f0455add3e06
user: Rouslan Placella <rouslan at placella.com>
date: Sun Apr 15 14:18:32 2012 +0100
description:
Fixed "Undefind constant XHTML" by implementing a minimal theme API

diffstat:

 public_html/layout/newpro/functions.php           |  123 +++++++++++++---
 public_html/layout/professional/functions.php     |  122 +++++++++++++---
 public_html/layout/professional_css/functions.php |  122 +++++++++++++---
 public_html/lib-common.php                        |  158 +++++++++++++--------
 4 files changed, 394 insertions(+), 131 deletions(-)

diffs (truncated from 621 to 300 lines):

diff -r 2da121130eca -r f0455add3e06 public_html/layout/newpro/functions.php
--- a/public_html/layout/newpro/functions.php	Tue Apr 10 17:39:02 2012 +0100
+++ b/public_html/layout/newpro/functions.php	Sun Apr 15 14:18:32 2012 +0100
@@ -1,42 +1,117 @@
 <?php
 
+/* Reminder: always indent with 4 spaces (no tabs). */
+// +---------------------------------------------------------------------------+
+// | Geeklog 2.0                                                               |
+// +---------------------------------------------------------------------------+
+// | functions.php                                                             |
+// |                                                                           |
+// | Functions implementing the theme API                                      |
+// +---------------------------------------------------------------------------+
+// | Copyright (C) 2000-2012 by the following authors:                         |
+// |                                                                           |
+// | Authors: Tony Bibbs        - tony AT tonybibbs DOT com                    |
+// |          Mark Limburg      - mlimburg AT users DOT sourceforge DOT net    |
+// |          Jason Whittenburg - jwhitten AT securitygeeks DOT com            |
+// |          Dirk Haun         - dirk AT haun-online DOT de                   |
+// |          Vincent Furia     - vinny01 AT users DOT sourceforge DOT net     |
+// |          Rouslan Placella  - rouslan AT placella DOT com                  |
+// +---------------------------------------------------------------------------+
+// |                                                                           |
+// | This program is free software; you can redistribute it and/or             |
+// | modify it under the terms of the GNU General Public License               |
+// | as published by the Free Software Foundation; either version 2            |
+// | of the License, or (at your option) any later version.                    |
+// |                                                                           |
+// | This program is distributed in the hope that it will be useful,           |
+// | but WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |
+// | GNU General Public License for more details.                              |
+// |                                                                           |
+// | You should have received a copy of the GNU General Public License         |
+// | along with this program; if not, write to the Free Software Foundation,   |
+// | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           |
+// |                                                                           |
+// +---------------------------------------------------------------------------+
+
 // this file can't be used on its own
 if (strpos(strtolower($_SERVER['PHP_SELF']), 'functions.php') !== false) {
     die('This file can not be used on its own!');
 }
 
-$_IMAGE_TYPE = 'png';
+/**
+ * Return the configuration values for the theme
+ */
+function theme_config_newpro()
+{
+    return array(
+        'image_type' => 'png',
+        'doctype' => 'xhtml10strict'
+    );
+}
 
-// Add Theme CSS File to scripts class
-$_SCRIPTS->setCSSFile('theme', '/layout/' . $_CONF['theme'] . '/style.css.php?dir=' . $LANG_DIRECTION);
+/**
+ * Return an array of CSS files to be loaded
+ */
+function theme_css_newpro()
+{
+    global $_CONF, $LANG_DIRECTION;
+    return array(
+        '/layout/' . $_CONF['theme'] . '/style.css.php?dir=' . $LANG_DIRECTION
+    );
+}
 
-$_SCRIPTS->setJavaScriptLibrary('jquery');
+/**
+ * Return an array of JS libraries to be loaded
+ */
+function theme_js_libs_newpro()
+{
+    return array(
+        'jquery'
+    );
+}
 
-$_SCRIPTS->setJavaScriptFile('theme.confirm', '/layout/' . $_CONF['theme'] . '/javascript/confirm.js');
-$_SCRIPTS->setJavaScriptFile('theme.confirm', '/layout/' . $_CONF['theme'] . '/javascript/search.js');
+/**
+ * Return an array of JS files to be loaded
+ */
+function theme_js_files_newpro()
+{
+    global $_CONF;
+    return array(
+        '/layout/' . $_CONF['theme'] . '/javascript/confirm.js',
+        '/layout/' . $_CONF['theme'] . '/javascript/search.js'
+    );
+}
 
-/*
- * For left/right block support there is no longer any need for the theme to
- * put code into functions.php to set specific templates for the left/right
- * versions of blocks. Instead, Geeklog will automagically look for
- * blocktemplate-left.thtml and blocktemplate-right.thtml if given
- * blocktemplate.thtml from $_BLOCK_TEMPLATE. So, if you want different left
- * and right templates from admin_block, just create blockheader-list-left.thtml
- * etc.
+/**
+ * Do any other initialisation here
  */
+function theme_init_newpro()
+{
+    global $_BLOCK_TEMPLATE;
 
-$_BLOCK_TEMPLATE['_msg_block'] = 'blockheader-message.thtml,blockfooter-message.thtml';
-$_BLOCK_TEMPLATE['configmanager_block'] = 'blockheader-config.thtml,blockfooter-config.thtml';
-$_BLOCK_TEMPLATE['configmanager_subblock'] = 'blockheader-config.thtml,blockfooter-config.thtml';
-$_BLOCK_TEMPLATE['whats_related_block'] = 'blockheader-related.thtml,blockfooter-related.thtml';
-$_BLOCK_TEMPLATE['story_options_block'] = 'blockheader-related.thtml,blockfooter-related.thtml';
+    /*
+     * For left/right block support there is no longer any need for the theme to
+     * put code into functions.php to set specific templates for the left/right
+     * versions of blocks. Instead, Geeklog will automagically look for
+     * blocktemplate-left.thtml and blocktemplate-right.thtml if given
+     * blocktemplate.thtml from $_BLOCK_TEMPLATE. So, if you want different left
+     * and right templates from admin_block, just create blockheader-list-left.thtml
+     * etc.
+     */
+    $_BLOCK_TEMPLATE['_msg_block'] = 'blockheader-message.thtml,blockfooter-message.thtml';
+    $_BLOCK_TEMPLATE['configmanager_block'] = 'blockheader-config.thtml,blockfooter-config.thtml';
+    $_BLOCK_TEMPLATE['configmanager_subblock'] = 'blockheader-config.thtml,blockfooter-config.thtml';
+    $_BLOCK_TEMPLATE['whats_related_block'] = 'blockheader-related.thtml,blockfooter-related.thtml';
+    $_BLOCK_TEMPLATE['story_options_block'] = 'blockheader-related.thtml,blockfooter-related.thtml';
 
-// Define the blocks that are a list of links styled as an unordered list - using class="blocklist"
-$_BLOCK_TEMPLATE['admin_block'] = 'blockheader-list.thtml,blockfooter-list.thtml';
-$_BLOCK_TEMPLATE['section_block'] = 'blockheader-list.thtml,blockfooter-list.thtml';
+    // Define the blocks that are a list of links styled as an unordered list - using class="blocklist"
+    $_BLOCK_TEMPLATE['admin_block'] = 'blockheader-list.thtml,blockfooter-list.thtml';
+    $_BLOCK_TEMPLATE['section_block'] = 'blockheader-list.thtml,blockfooter-list.thtml';
 
-if (!COM_isAnonUser()) {
-    $_BLOCK_TEMPLATE['user_block'] = 'blockheader-list.thtml,blockfooter-list.thtml';
+    if (! COM_isAnonUser()) {
+        $_BLOCK_TEMPLATE['user_block'] = 'blockheader-list.thtml,blockfooter-list.thtml';
+    }
 }
 
 ?>
diff -r 2da121130eca -r f0455add3e06 public_html/layout/professional/functions.php
--- a/public_html/layout/professional/functions.php	Tue Apr 10 17:39:02 2012 +0100
+++ b/public_html/layout/professional/functions.php	Sun Apr 15 14:18:32 2012 +0100
@@ -1,39 +1,115 @@
 <?php
 
+/* Reminder: always indent with 4 spaces (no tabs). */
+// +---------------------------------------------------------------------------+
+// | Geeklog 2.0                                                               |
+// +---------------------------------------------------------------------------+
+// | functions.php                                                             |
+// |                                                                           |
+// | Functions implementing the theme API                                      |
+// +---------------------------------------------------------------------------+
+// | Copyright (C) 2000-2012 by the following authors:                         |
+// |                                                                           |
+// | Authors: Tony Bibbs        - tony AT tonybibbs DOT com                    |
+// |          Mark Limburg      - mlimburg AT users DOT sourceforge DOT net    |
+// |          Jason Whittenburg - jwhitten AT securitygeeks DOT com            |
+// |          Dirk Haun         - dirk AT haun-online DOT de                   |
+// |          Vincent Furia     - vinny01 AT users DOT sourceforge DOT net     |
+// |          Rouslan Placella  - rouslan AT placella DOT com                  |
+// +---------------------------------------------------------------------------+
+// |                                                                           |
+// | This program is free software; you can redistribute it and/or             |
+// | modify it under the terms of the GNU General Public License               |
+// | as published by the Free Software Foundation; either version 2            |
+// | of the License, or (at your option) any later version.                    |
+// |                                                                           |
+// | This program is distributed in the hope that it will be useful,           |
+// | but WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |
+// | GNU General Public License for more details.                              |
+// |                                                                           |
+// | You should have received a copy of the GNU General Public License         |
+// | along with this program; if not, write to the Free Software Foundation,   |
+// | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           |
+// |                                                                           |
+// +---------------------------------------------------------------------------+
+
 // this file can't be used on its own
 if (strpos(strtolower($_SERVER['PHP_SELF']), 'functions.php') !== false) {
     die('This file can not be used on its own!');
 }
 
-$_IMAGE_TYPE = 'png';
+/**
+ * Return the configuration values for the theme
+ */
+function theme_config_professional()
+{
+    return array(
+        'image_type' => 'png',
+        'doctype' => 'xhtml10strict'
+    );
+}
 
-// Add Theme CSS File to scripts class
-$_SCRIPTS->setCSSFile('theme', '/layout/' . $_CONF['theme'] . '/style.css');
+/**
+ * Return an array of CSS files to be loaded
+ */
+function theme_css_professional()
+{
+    global $_CONF, $LANG_DIRECTION;
+    return array(
+        '/layout/' . $_CONF['theme'] . '/style.css'
+    );
+}
 
-// Load jQuery
-$_SCRIPTS->setJavaScriptLibrary('jquery');
+/**
+ * Return an array of JS libraries to be loaded
+ */
+function theme_js_libs_professional()
+{
+    return array(
+        'jquery'
+    );
+}
 
-/*
- * For left/right block support there is no longer any need for the theme to
- * put code into functions.php to set specific templates for the left/right
- * versions of blocks. Instead, Geeklog will automagically look for
- * blocktemplate-left.thtml and blocktemplate-right.thtml if given
- * blocktemplate.thtml from $_BLOCK_TEMPLATE. So, if you want different left
- * and right templates from admin_block, just create blockheader-list-left.thtml
- * etc.
+/**
+ * Return an array of JS files to be loaded
  */
+function theme_js_files_professional()
+{
+    global $_CONF;
+    return array(
+    );
+}
 
-$_BLOCK_TEMPLATE['_msg_block'] = 'blockheader-message.thtml,blockfooter-message.thtml';
-$_BLOCK_TEMPLATE['configmanager_block'] = 'blockheader-config.thtml,blockfooter-config.thtml';
-$_BLOCK_TEMPLATE['configmanager_subblock'] = 'blockheader-config.thtml,blockfooter-config.thtml';
-$_BLOCK_TEMPLATE['whats_related_block'] = 'blockheader-related.thtml,blockfooter-related.thtml';
-$_BLOCK_TEMPLATE['story_options_block'] = 'blockheader-related.thtml,blockfooter-related.thtml';
+/**
+ * Do any other initialisation here
+ */
+function theme_init_professional()
+{
+    global $_BLOCK_TEMPLATE;
 
-// Define the blocks that are a list of links styled as an unordered list - using class="blocklist"
-$_BLOCK_TEMPLATE['admin_block'] = 'blockheader-list.thtml,blockfooter-list.thtml';
-$_BLOCK_TEMPLATE['section_block'] = 'blockheader-list.thtml,blockfooter-list.thtml';
-if (!COM_isAnonUser()) {
-    $_BLOCK_TEMPLATE['user_block'] = 'blockheader-list.thtml,blockfooter-list.thtml';
+    /*
+     * For left/right block support there is no longer any need for the theme to
+     * put code into functions.php to set specific templates for the left/right
+     * versions of blocks. Instead, Geeklog will automagically look for
+     * blocktemplate-left.thtml and blocktemplate-right.thtml if given
+     * blocktemplate.thtml from $_BLOCK_TEMPLATE. So, if you want different left
+     * and right templates from admin_block, just create blockheader-list-left.thtml
+     * etc.
+     */
+    $_BLOCK_TEMPLATE['_msg_block'] = 'blockheader-message.thtml,blockfooter-message.thtml';
+    $_BLOCK_TEMPLATE['configmanager_block'] = 'blockheader-config.thtml,blockfooter-config.thtml';
+    $_BLOCK_TEMPLATE['configmanager_subblock'] = 'blockheader-config.thtml,blockfooter-config.thtml';
+    $_BLOCK_TEMPLATE['whats_related_block'] = 'blockheader-related.thtml,blockfooter-related.thtml';
+    $_BLOCK_TEMPLATE['story_options_block'] = 'blockheader-related.thtml,blockfooter-related.thtml';
+
+    // Define the blocks that are a list of links styled as an unordered list - using class="blocklist"
+    $_BLOCK_TEMPLATE['admin_block'] = 'blockheader-list.thtml,blockfooter-list.thtml';
+    $_BLOCK_TEMPLATE['section_block'] = 'blockheader-list.thtml,blockfooter-list.thtml';
+
+    if (! COM_isAnonUser()) {
+        $_BLOCK_TEMPLATE['user_block'] = 'blockheader-list.thtml,blockfooter-list.thtml';
+    }
 }
 
 ?>
diff -r 2da121130eca -r f0455add3e06 public_html/layout/professional_css/functions.php
--- a/public_html/layout/professional_css/functions.php	Tue Apr 10 17:39:02 2012 +0100
+++ b/public_html/layout/professional_css/functions.php	Sun Apr 15 14:18:32 2012 +0100
@@ -1,40 +1,116 @@
 <?php
 
+/* Reminder: always indent with 4 spaces (no tabs). */
+// +---------------------------------------------------------------------------+
+// | Geeklog 2.0                                                               |
+// +---------------------------------------------------------------------------+
+// | functions.php                                                             |
+// |                                                                           |
+// | Functions implementing the theme API                                      |



More information about the geeklog-cvs mailing list