[geeklog-cvs] geeklog: Added support for a CUSTOM_renderMenu function when ren...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sun Sep 6 10:18:01 EDT 2009


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/62bd06e50034
changeset: 7291:62bd06e50034
user:      Dirk Haun <dirk at haun-online.de>
date:      Sun Sep 06 15:37:18 2009 +0200
description:
Added support for a CUSTOM_renderMenu function when rendering the top menu (feature request #0000845)

diffstat:

 public_html/docs/history   |   2 ++
 public_html/lib-common.php |  45 ++++++++++++++++++++++-----------------------
 2 files changed, 24 insertions(+), 23 deletions(-)

diffs (68 lines):

diff -r 15be5bd03553 -r 62bd06e50034 public_html/docs/history
--- a/public_html/docs/history	Sun Sep 06 15:12:47 2009 +0200
+++ b/public_html/docs/history	Sun Sep 06 15:37:18 2009 +0200
@@ -3,6 +3,8 @@
 Oct ??, 2009 (1.6.1)
 ------------
 
+- Added support for a CUSTOM_renderMenu function when rendering the top menu
+  (feature request #0000845) [Dirk]
 - In the install script, always open db-config.php and siteconfig.php in
   binary mode to avoid EOL character mixup on Windows (bug #0000730) [Dirk]
 - Avoid SQL error with certain db dumps during migration (bug #0000955) [Dirk]
diff -r 15be5bd03553 -r 62bd06e50034 public_html/lib-common.php
--- a/public_html/lib-common.php	Sun Sep 06 15:12:47 2009 +0200
+++ b/public_html/lib-common.php	Sun Sep 06 15:37:18 2009 +0200
@@ -639,30 +639,29 @@
                 break;
 
             case 'custom':
-                $custom_count = 0;
-                $custom_size = sizeof( $custom_entries );
-                foreach( $custom_entries as $entry )
-                {
-                    $custom_count++;
-
-                    if( empty( $entry['url'] ) || empty( $entry['label'] ))
-                    {
-                        continue;
+                if (function_exists('CUSTOM_renderMenu')) {
+                    CUSTOM_renderMenu($header, $custom_entries, $menuCounter);
+                } else {
+                    $custom_count = 0;
+                    $custom_size = count($custom_entries);
+                    foreach ($custom_entries as $entry) {
+                        $custom_count++;
+
+                        if (empty($entry['url']) || empty($entry['label'])) {
+                            continue;
+                        }
+
+                        $header->set_var('menuitem_url',  $entry['url']);
+                        $header->set_var('menuitem_text', $entry['label']);
+
+                        if ($last_entry && ($custom_count == $custom_size)) {
+                            $header->parse('menu_elements', 'menuitem_last',
+                                           true);
+                        } else {
+                            $header->parse('menu_elements', 'menuitem', true);
+                        }
+                        $menuCounter++;
                     }
-
-                    $header->set_var( 'menuitem_url',  $entry['url'] );
-                    $header->set_var( 'menuitem_text', $entry['label'] );
-
-                    if( $last_entry && ( $custom_count == $custom_size ))
-                    {
-                        $header->parse( 'menu_elements', 'menuitem_last',
-                                        true );
-                    }
-                    else
-                    {
-                        $header->parse( 'menu_elements', 'menuitem', true );
-                    }
-                    $menuCounter++;
                 }
                 $url = '';
                 $label = '';



More information about the geeklog-cvs mailing list