function printRow($menuitem, $indent = 0) { // Updated code May 14th 2009 $title = $menuitem["title"]; if ((strpos($menuitem["title"], "<img") || strpos($menuitem["title"], "< img")) >= 0) { $title = str_replace(">", " \"height=16\">", $menuitem["title"]); } // End Updated code May 14th 2009 //$thepluginurl = bloginfo('wpurl'); ?> <li id='item_<?php echo $menuitem["id"]; ?> ' class='alternate mclist'> <table width="780" cellpadding="3" cellspacing="0"> <tr class="itemrows"> <td scope="row" width="30" valign="top" align="center"><?php echo $menuitem["id"]; ?> </td> <td scope="row" width="220" valign="top" align="left" ><?php for ($i = 0; $i < $indent; $i++) { echo "⇒ "; } ?> <a class="edit" href="?page=mc-edit-menuitem&id=<?php echo $menuitem["id"]; ?> "><?php echo $title; ?> </a></td> <td scope="row" width="60" valign="top" align="left"><?php echo $menuitem["type"]; ?> </td> <td scope="row" width="320" valign="top" align="left"><span class="urlvalue"><?php echo $menuitem["type"] == "wordpress" ? "(" . $menuitem["value"] . ") " : ""; echo resolveURL($menuitem); ?> </span></td> <td scope="row" width="80" valign="top" align="left"><?php //echo $menuitem['order']." "; if (!hasChild($menuitem['id']) && $menuitem['parent'] > 0) { echo "<a href='?page=mc-edit-menu&id=" . $menuitem['menu'] . "&level=up&item_id=" . $menuitem['id'] . "'><img src='../wp-content/plugins/wp-menu-creator/images/up.gif' />" . "</a> "; } if (hasFriendAbove($menuitem['parent'], $menuitem['order'])) { echo "<a href='?page=mc-edit-menu&id=" . $menuitem['menu'] . "&level=down&item_id=" . $menuitem['id'] . "'><img src='../wp-content/plugins/wp-menu-creator/images/down.gif' />" . "</a>"; } ?> </td> <td scope="row" width="5" valign="top" class="verticalback"> </td> <td scope="row" valign="top" width="65" align="left"><a class="edit" href="?page=mc-edit-menuitem&id=<?php echo $menuitem["id"]; ?> "><img src="<?php bloginfo('wpurl'); ?> /wp-content/plugins/wp-menu-creator/images/edit.gif" /></a> <a href='?page=mc-edit-menu&action=deletemenuitem&id=<?php echo $menuitem["menu"]; ?> &target=<?php echo $menuitem["id"]; ?> ' class="delete" onclick="return confirmDelete(this);"><img src="<?php bloginfo('wpurl'); ?> /wp-content/plugins/wp-menu-creator/images/delete.gif" /></a></td> </tr> </table> </li> <?php }
function displayMenuFromItems($items, $depth, $parent, $ismenu) { if ($items) { echo "\n" . '<ul id="' . ($ismenu ? "menu" : "mc_submenu_" . $parent) . '" class="mc_menu mc_depth_' . $depth . '">' . "\n"; foreach ($items as $item) { $class = ""; if ($item["type"] == "wordpress") { if (is_page($item["value"])) { $class = "current_page_item"; } } else { if (curPageURL() == $item["value"] || curPageURL() == $item["value"] . "/") { $class = "current_page_item"; } } $pos = strpos(pageURL(), '#'); /*if(isset($_GET['cat']) || isset($_GET['p']) || isset($_GET['m']) || isset($_GET['author']) || $pos != false) { $urlAddon = 'index.php'; } else { $urlAddon = ''; }*/ if (!isset($_GET['cat']) && !isset($_GET['p']) && !isset($_GET['m']) && !isset($_GET['author']) && ($pos != false || pageURL() == get_bloginfo('url') . '/') || pageURL() == get_bloginfo('url')) { $findHash = strpos($item['value'], '#'); if ($findHash != false) { $item['value'] = substr($item['value'], $findHash); } } echo '<li id="menu_item_' . $item["id"] . '" class="mc_menu_item ' . ($item["type"] == "wordpress" ? "wordpress_link" : "external_link") . ' ' . $class . '"><a href="' . $urlAddon . resolveURL($item) . '" title="' . ($ismenu ? $item["id"] : $parent) . '" rel="' . $item["target"] . '" class="change_section panel ' . (count($item["subitems"]) > 0 ? 'submenu' : '') . '">' . $item["title"] . '</a>'; if ($depth > 0) { displayMenuFromItems($item["subitems"], $depth - 1, $item["id"], false); } echo '</li>' . "\n"; } echo '</ul>' . "\n"; } }