Пример #1
0
 /**
  * Handle the importation of Firefox HTML bookmarks
  *
  * Use external library firefox/bookmarks.class.php to parse html files
  *
  * @see firefox/bookmarks.class.php
  *
  * @return a list of WpHerissonBookmarks
  */
 public function import()
 {
     $this->preImport();
     include HERISSON_VENDOR_DIR . "firefox/bookmarks.class.php";
     $filename = $this->getFilename();
     // Parsing bookmarks file
     $bookmarks = new \Bookmarks();
     $bookmarks->parse($filename);
     $bookmarks->bookmarksFileMd5 = md5_file($filename);
     $list = array();
     //$page_title = __("Importation results from Firefox bookmarks", HERISSON_TD);
     $i = 0;
     $spacer = "    ";
     while ($bookmarks->hasMoreItems()) {
         $item = $bookmarks->getNextElement();
         $bookmark = array();
         $bookmark['title'] = $item->name;
         if ($item->_isFolder) {
             $space = str_repeat($spacer, $item->depth - 1);
             $bookmark['prefix'] = $space;
             $bookmark['url'] = "";
             $bookmark['description'] = "";
             $bookmark['is_public'] = 1;
             $bookmark['favicon_image'] = "";
             $bookmark['favicon_url'] = "";
             $bookmark['tags'] = "";
         } else {
             $bookmark['url'] = $item->HREF;
             $bookmark['description'] = "";
             $bookmark['is_public'] = 1;
             $bookmark['favicon_image'] = $item->ICON_DATA;
             $bookmark['favicon_url'] = $item->ICON_URI;
             $bookmark['tags'] = "";
         }
         $list[] = $bookmark;
     }
     unset($bookmarks);
     return $list;
 }