'; $xbel_options['list_tween'] = '
'; $xbel_options['list_end'] = '
'; // this is a list of folders, you don't want to be shown on the website $xbel_options['exclude_folders'] = array(); /* DO NOT EDIT BELOW UNLESS YOU KNOW WHAT YOU'RE DOING! IF YOU KNOW WHAT YOU'RE DOING: HAVE FUN */ extract($xbel_options); if(isset($_POST['xbel_form']) && $_POST['xbel_form']) { if(isset($_POST['xbel_url'])) { if(substr($_POST['xbel_url'], 0, 7) != 'http://') { $xbel_url = 'http://' . $_POST['xbel_url']; } else { $xbel_url = $_POST['xbel_url']; } if(!isset($_POST['xbel_title'])) { $xbel_title = $xbel_url; } else { $xbel_title = $_POST['xbel_title']; } $xml = str_replace('', '', file_get_contents($path_to_xml)); $fp = fopen($path_to_xml, "w"); $xml .= ''; $xml .= '' . $xbel_title . ''; $xml .= ''; $xml .= ''; $xml .= ''; fwrite ($fp,$xml); fclose($fp); } } function wp_xbel() { global $xbel_options; extract($xbel_options); if($folder_display != 'collapsable' && $folder_display != 'flat') $folder_display = 'collapsable'; if($folder_collapse != 'each' && $folder_collapse != 'root') $folder_collapse = 'each'; if($folder_display == 'collapsable') { ?> '; // Process rest of xbel information $x++; while($values[$x]['tag'] != 'bookmark' && $values[$x]['tag'] != 'folder' && $values[$x]['tag'] != 'xbel') { if($values[$x]['tag'] == 'title') { $xbel_title = $values[$x]['value']; } $x++; } $x--; // Format and print xbel information #echo '

' . $xbel_title . '

'; // clear out variables if(isset($xbel_title)) unset($xbel_title); break; case 'close': echo ''; break; } break; case 'folder': switch($values[$x]['type']) { case 'open': $fldr_id = str_replace('rdf%3A#$', 'a', $values[$x]['attributes']['id']); // Process rest of folder information $x++; while($values[$x]['tag'] != 'bookmark' && $values[$x]['tag'] != 'folder') { if($values[$x]['tag'] == 'title') { $fldr_title = trim($values[$x]['value']); $fldr_level = $values[$x]['level'] - 1; } else if($values[$x]['tag'] == 'desc') { $fldr_desc = trim($values[$x]['value']); } $x++; } $x--; // exclude folders if (in_array($fldr_title, $xbel_options['exclude_folders'])) { $exclusion = true; $exclusion_level = $fldr_level; } if (!$exclusion) { echo "\t" . '
'; // Format and print folder information if ($folder_display == 'collapsable' && ($folder_collapse == 'each' || ($folder_collapse == 'root' && $values[$x]['level'] == 3))) { echo "\t\t" . '
' . $fldr_title . '
'; echo "\t\t" . '"; } // reset exclusion if ($values[$x]['level'] == $exclusion_level) { $exclusion = false; } break; } break; case 'bookmark': switch($values[$x]['type']) { case 'open': $last_obj = $values[$x]['tag']; $bkmk_url = $values[$x]['attributes']['href']; // Process rest of bookmark information $x++; while($values[$x]['tag'] != 'bookmark') { if($values[$x]['tag'] == 'title') { $bkmk_title = trim($values[$x]['value']); } else if($values[$x]['tag'] == 'desc') { $bkmk_desc = trim($values[$x]['value']); } else if($values[$x]['tag'] == 'metadata' && isset($values[$x]['attributes']['Icon'])) { $bkmk_icon = $values[$x]['attributes']['Icon']; } $x++; } if (!$exclusion) { // Format and print bookmark information echo "\t\t\t" . '
'; if(strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { if($display_default) echo "\t\t\t\t" . 'Default Icon'; } else { if(isset($bkmk_icon) && $display_icon) echo "\t\t\t\t" . 'Bookmark Icon'; if((!isset($bkmk_icon) && $display_default) || (!$display_icon && $display_default)) echo "\t\t\t\t" . 'Default Icon'; } echo "\t\t\t\t" . '' . htmlspecialchars($bkmk_title) . "\t\t\t
"; if($display_desc == 'bookmark' || $display_desc == 'all') echo "\t\t\t" . '
' . $bkmk_desc . '
'; } // clear out variables if(isset($bkmk_title)) unset($bkmk_title); if(isset($bkmk_url)) unset($bkmk_url); if(isset($bkmk_desc)) unset($bkmk_desc); if(isset($bkmk_icon)) unset($bkmk_icon); break; } break; case 'separator': if (!$exclusion) { echo "\t" . '
'; } break; } } } function wp_xbel_root_list() { global $xbel_options; extract($xbel_options); $xml = file_get_contents($path_to_xml); $values = ''; $index = ''; $list = array(); $started = FALSE; $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parse_into_struct($parser, $xml, $values, $index); xml_parser_free($parser); for($x = 0; $x < sizeof($values); $x++) { if($values[$x]['tag'] == 'folder' && $values[$x]['type'] == 'open' && $values[$x]['level'] == 2) { if($started) { echo $list_tween; } else { echo $list_start; $started = TRUE; } echo '' . $values[$x+1]['value'] . ''; } } if($started) { echo $list_end; } } function wp_xbel_form() { ?>
Submit Link
Title:
Link: