Skip to content

Commit

Permalink
php: ensure 5.3 compatibility
Browse files Browse the repository at this point in the history
Closes #2

Signed-off-by: VirtualTam <[email protected]>
  • Loading branch information
virtualtam committed Feb 24, 2016
1 parent 3779b15 commit 1c6902a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ php:
- 5.6
- 5.5
- 5.4
- 5.3
install:
- composer self-update
- composer install
Expand Down
6 changes: 3 additions & 3 deletions parse_netscape_bookmarks.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
function parse_netscape_bookmarks($bkmk_str, $default_tag = null) {
$i = 0;
$next = false;
$items = [];
$items = array();

$current_tag = $default_tag = $default_tag ?: 'imported-'.date("Ymd");

$bkmk_str = str_replace(["\r","\n","\t"], ['','',' '], $bkmk_str);
$bkmk_str = str_replace(array("\r","\n","\t"), array('','',' '), $bkmk_str);

$bkmk_str = preg_replace_callback('@<dd>(.*?)(<A|<\/|<DL|<DT|<P)@mis', function($m) {
return '<dd>'.str_replace(["\r", "\n"], ['', '<br>'], trim($m[1])).'</';
return '<dd>'.str_replace(array("\r", "\n"), array('', '<br>'), trim($m[1])).'</';
}, $bkmk_str);

$bkmk_str = preg_replace('/>(\s*?)</mis', ">\n<", $bkmk_str);
Expand Down

0 comments on commit 1c6902a

Please sign in to comment.