bookmark import export
More...
◆ __parseExport()
static ilBookmarkImportExport::__parseExport |
( |
|
$object, |
|
|
|
$depth = 1 , |
|
|
|
$recursive = true |
|
) |
| |
|
static |
recursive methode generates bookmark output for export
- Parameters
-
array | node date |
int | depth of recursion |
bool | true for recursive export private |
Definition at line 138 of file class.ilBookmarkImportExport.php.
References $result, ilBookmarkFolder\getObjects(), and ilUtil\prepareFormOutput().
Referenced by _exportBookmark().
140 switch ($object[
'type'])
143 $result.=str_repeat(
"\t",$depth);
144 $result.=
'<DT><A HREF="'.ilUtil::prepareFormOutput($object[
'target']).
'" ';
145 $result.=
'ADD_DATE="'.intval(0).
'" ';
146 $result.=
'LAST_VISIT="'.intval(0).
'" ';
147 $result.=
'LAST_MODIFIED="'.intval(0).
'">';
149 if ($object[
'description'])
$result.=
'<DD>'.
153 $result.=str_repeat(
"\t",$depth).
'<DT><H3 ADD_DATE="0">'.
155 if ($object[
'description'])
$result.=
'<DD>'.
157 $result.=str_repeat(
"\t",$depth).
'<DL><p>'.
"\n";
162 foreach ($sub_objects as $sub_object)
169 $result.=str_repeat(
"\t",$depth).
'</DL><p>'.
"\n";
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
static __parseExport($object, $depth=1, $recursive=true)
recursive methode generates bookmark output for export
static getObjects($a_id)
static
◆ __parseNetscape()
static ilBookmarkImportExport::__parseNetscape |
( |
& |
$fp | ) |
|
|
static |
parse Netscape bookmark file
- Parameters
-
Definition at line 40 of file class.ilBookmarkImportExport.php.
References $ok, $result, $url, _convertCharset(), _decodeEntities(), and array.
Referenced by _parseFile().
47 while ($line=fgets($fp))
50 if (preg_match(
'/<DL>/i',$line))
54 elseif (preg_match(
'/<\/DL>/i',$line))
56 $parent_id=array_pop($parent);
58 elseif (preg_match(
'/<DD>(.+)$/i',$line,$match))
63 $result[$parent_id][$id][
'description']=strip_tags($desc);
65 elseif (preg_match(
'/<DT><H3[^>]*>(.*)<\/H3>/i',$line,$match))
68 array_push($parent,$parent_id);
74 'title'=>strip_tags($name),
77 elseif (preg_match(
'/<DT><A HREF="([^"]*)[^>]*>(.*)<\/A>/i', $line, $match))
86 if (preg_match(
"/ADD_DATE=\"([^\"]*)/i", $line, $match)) $add_date = $match[1];
else $add_date=0;
87 if (preg_match(
"/LAST_VISIT=\"([^\"]*)/i", $line, $match)) $visited = $match[1];
else $visited=0;
88 if (preg_match(
"/LAST_MODIFIED=\"([^\"]*)/i", $line, $match)) $modified = $match[1];
else $modified=0;
91 'target'=>strip_tags(
$url),
92 'title'=>strip_tags($name),
93 'add_date'=>$add_date,
95 'modified'=>$modified,
98 elseif (preg_match(
"/<META\s+HTTP-EQUIV=\"Content-Type\".+CONTENT=\"([^\"]*)\"/i", $line, $match))
100 preg_match(
"/charset=([^ ]+)/", $match[1], $match);
static _convertCharset($string, $from_charset='', $to_charset='UTF-8')
converts charset of given string
Create styles array
The data for the language used.
static _decodeEntities($string)
decode html entities of given string
◆ _convertCharset()
static ilBookmarkImportExport::_convertCharset |
( |
|
$string, |
|
|
|
$from_charset = '' , |
|
|
|
$to_charset = 'UTF-8' |
|
) |
| |
|
static |
converts charset of given string
- Parameters
-
string | string to converte |
string | from charset |
string | to charset public |
Definition at line 215 of file class.ilBookmarkImportExport.php.
Referenced by __parseNetscape().
217 if (extension_loaded(
"mbstring"))
222 mb_detect_order(
"ASCII, JIS, UTF-8, EUC-JP, SJIS, ISO-8859-15, Windows-1252");
223 $from_charset=mb_detect_encoding ($string);
225 if (strtoupper($from_charset)!=$to_charset)
227 return @mb_convert_encoding($string,$to_charset,$from_charset);
◆ _decodeEntities()
static ilBookmarkImportExport::_decodeEntities |
( |
|
$string | ) |
|
|
static |
decode html entities of given string
- Parameters
-
string | string to decode public |
Definition at line 180 of file class.ilBookmarkImportExport.php.
Referenced by __parseNetscape().
182 if (function_exists(
'html_entity_decode'))
184 $string= html_entity_decode($string,ENT_QUOTES,
"ISO-8859-15"); #NOTE: UTF-8 does not work!
188 $trans_table = array_flip(get_html_translation_table(HTML_ENTITIES, ENT_QUOTES));
189 $string = strtr($string, $trans_table );
191 $string= preg_replace_callback(
198 $string= preg_replace_callback(
199 '/&#x([a-f0-9]+);/mi',
201 return chr(hexdec($hit[1]));
◆ _exportBookmark()
static ilBookmarkImportExport::_exportBookmark |
( |
|
$obj_ids, |
|
|
|
$recursive = true , |
|
|
|
$title = '' |
|
) |
| |
|
static |
export bookmarks static method return html string
- Parameters
-
array | array of bookmark ids to export |
bool | true for recursive export |
string | title of html page |
Definition at line 113 of file class.ilBookmarkImportExport.php.
References $title, __parseExport(), and ilBookmarkFolder\getObject().
Referenced by ilBookmarkAdministrationGUI\export().
115 $htmlCont=
'<!DOCTYPE NETSCAPE-Bookmark-file-1>'.
"\n";
116 $htmlCont.=
'<!-- Created by ilias - www.ilias.de -->'.
"\n";
117 $htmlCont.=
'<!-- on '.date(
'r').
' -->'.
"\n\n";
118 $htmlCont.=
'<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">'.
"\n";
119 $htmlCont.=
'<TITLE>'.ilUtil::prepareFormOutput(
$title).
'</TITLE>'.
"\n";
120 $htmlCont.=
'<H1>'.ilUtil::prepareFormOutput(
$title).
'</H1>'.
"\n\n";
121 $htmlCont.=
'<DL><p>'.
"\n";
122 foreach ($obj_ids as $obj_id) {
126 $htmlCont.=
'</DL><p>'.
"\n";
static getObject($a_id)
static
static __parseExport($object, $depth=1, $recursive=true)
recursive methode generates bookmark output for export
◆ _parseFile()
static ilBookmarkImportExport::_parseFile |
( |
|
$file | ) |
|
|
static |
parse Bookmark file static method returns 3 dimensional array of bookmarks and folders
- Parameters
-
Definition at line 19 of file class.ilBookmarkImportExport.php.
References $file, and __parseNetscape().
Referenced by ilBookmarkAdministrationGUI\importFile().
23 $fp = fopen(
$file,
"r-");
24 while ($line=fgets($fp))
27 if (preg_match(
'/<!DOCTYPE NETSCAPE-Bookmark-file-1>/i', $line)) {
static __parseNetscape(&$fp)
parse Netscape bookmark file
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
The documentation for this class was generated from the following file: