22 $fp = fopen(
$file,
"r-");
23 while ($line=fgets($fp)) {
25 if (preg_match(
'/<!DOCTYPE NETSCAPE-Bookmark-file-1>/i', $line)) {
45 while ($line=fgets($fp)) {
47 if (preg_match(
'/<DL>/i', $line)) {
49 } elseif (preg_match(
'/<\/DL>/i', $line)) {
50 $parent_id=array_pop($parent);
51 } elseif (preg_match(
'/<DD>(.+)$/i', $line, $match)) {
55 $result[$parent_id][
$id][
'description']=strip_tags($desc);
56 } elseif (preg_match(
'/<DT><H3[^>]*>(.*)<\/H3>/i', $line, $match)) {
58 array_push($parent, $parent_id);
64 'title'=>strip_tags(
$name),
66 } elseif (preg_match(
'/<DT><A HREF="([^"]*)[^>]*>(.*)<\/A>/i', $line, $match)) {
74 if (preg_match(
"/ADD_DATE=\"([^\"]*)/i", $line, $match)) {
75 $add_date = $match[1];
79 if (preg_match(
"/LAST_VISIT=\"([^\"]*)/i", $line, $match)) {
84 if (preg_match(
"/LAST_MODIFIED=\"([^\"]*)/i", $line, $match)) {
85 $modified = $match[1];
91 'target'=>strip_tags(
$url),
92 'title'=>strip_tags(
$name),
93 'add_date'=>$add_date,
95 'modified'=>$modified,
97 } elseif (preg_match(
"/<META\s+HTTP-EQUIV=\"Content-Type\".+CONTENT=\"([^\"]*)\"/i", $line, $match)) {
98 preg_match(
"/charset=([^ ]+)/", $match[1], $match);
113 $htmlCont=
'<!DOCTYPE NETSCAPE-Bookmark-file-1>' .
"\n";
114 $htmlCont.=
'<!-- Created by ilias - www.ilias.de -->' .
"\n";
115 $htmlCont.=
'<!-- on ' .
date(
'r') .
' -->' .
"\n\n";
116 $htmlCont.=
'<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">' .
"\n";
119 $htmlCont.=
'<DL><p>' .
"\n";
120 foreach ($obj_ids as $obj_id) {
124 $htmlCont.=
'</DL><p>' .
"\n";
138 switch ($object[
'type']) {
140 $result.=str_repeat(
"\t", $depth);
142 $result.=
'ADD_DATE="' . intval(0) .
'" ';
143 $result.=
'LAST_VISIT="' . intval(0) .
'" ';
144 $result.=
'LAST_MODIFIED="' . intval(0) .
'">';
146 if ($object[
'description']) {
152 $result.=str_repeat(
"\t", $depth) .
'<DT><H3 ADD_DATE="0">' .
154 if ($object[
'description']) {
158 $result.=str_repeat(
"\t", $depth) .
'<DL><p>' .
"\n";
162 foreach ($sub_objects as $sub_object) {
171 $result.=str_repeat(
"\t", $depth) .
'</DL><p>' .
"\n";
184 if (function_exists(
'html_entity_decode')) {
185 $string= html_entity_decode($string, ENT_QUOTES,
"ISO-8859-15"); #NOTE: UTF-8 does not work!
187 $trans_table = array_flip(get_html_translation_table(HTML_ENTITIES, ENT_QUOTES));
188 $string = strtr($string, $trans_table);
190 $string= preg_replace_callback(
197 $string= preg_replace_callback(
198 '/&#x([a-f0-9]+);/mi',
200 return chr(hexdec($hit[1]));
214 public static function _convertCharset($string, $from_charset=
'', $to_charset=
'UTF-8')
216 if (extension_loaded(
"mbstring")) {
217 if (!$from_charset) {
219 mb_detect_order(
"ASCII, JIS, UTF-8, EUC-JP, SJIS, ISO-8859-15, Windows-1252");
220 $from_charset=mb_detect_encoding($string);
222 if (strtoupper($from_charset)!=$to_charset) {
223 return @mb_convert_encoding($string, $to_charset, $from_charset);
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
static getObject($a_id)
static
static _convertCharset($string, $from_charset='', $to_charset='UTF-8')
converts charset of given string
if(!array_key_exists('StateId', $_REQUEST)) $id
static __parseNetscape(&$fp)
parse Netscape bookmark file
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Create styles array
The data for the language used.
static _exportBookmark($obj_ids, $recursive=true, $title='')
export bookmarks static method return html string
static _decodeEntities($string)
decode html entities of given string
static __parseExport($object, $depth=1, $recursive=true)
recursive methode generates bookmark output for export
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static getObjects($a_id)
static
static _parseFile($file)
parse Bookmark file static method returns 3 dimensional array of bookmarks and folders ...