function parseItem($itemNode) { $children = $itemNode->hasChildNodes() ? $itemNode->childNodes : false; $item = array(); if ($children) { foreach ($children as $child) { if ($child->nodeType == XML_ELEMENT_NODE) { // if($child->nodeName == '#text') // { // continue; // } if (hasChild($child)) { if (isset($item[$child->nodeName])) { if (isset($item[$child->nodeName][0])) { $item[$child->nodeName][] = parseItem($child); } else { $tmp = array(); $tmp[] = $item[$child->nodeName]; $tmp[] = parseItem($child); $item[$child->nodeName] = $tmp; } } else { $item[$child->nodeName] = parseItem($child); } } elseif ($child->nodeName == 'settings') { $item['settings'] = parseItem($child); } else { if (isset($item[$child->nodeName])) { if (is_array($item[$child->nodeName])) { $item[$child->nodeName][] = $child->nodeValue; } else { $tmp = array(); $tmp[] = $item[$child->nodeName]; $tmp[] = $child->nodeValue; $item[$child->nodeName] = $tmp; } } else { $item[$child->nodeName] = $child->nodeValue; } } } } } return $item; }
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 }