X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=application%2Fnetscape%2FNetscapeBookmarkUtils.php;fp=application%2FNetscapeBookmarkUtils.php;h=28665941507366a364930f4adcdde702cf983a25;hb=d9f6275ebca035fec8331652c677981056793ccc;hp=84dd2b2083e36f8d20755fbdb2d97502c83b15cd;hpb=38672ba0d1c722e5d6d33a58255ceb55e9410e46;p=github%2Fshaarli%2FShaarli.git diff --git a/application/NetscapeBookmarkUtils.php b/application/netscape/NetscapeBookmarkUtils.php similarity index 89% rename from application/NetscapeBookmarkUtils.php rename to application/netscape/NetscapeBookmarkUtils.php index 84dd2b20..28665941 100644 --- a/application/NetscapeBookmarkUtils.php +++ b/application/netscape/NetscapeBookmarkUtils.php @@ -1,9 +1,16 @@ getTimestamp(); $link['taglist'] = str_replace(' ', ',', $link['tags']); - if (startsWith($link['url'], '?') && $prependNoteUrl) { + if (is_note($link['url']) && $prependNoteUrl) { $link['url'] = $indexUrl . $link['url']; } @@ -84,7 +91,7 @@ class NetscapeBookmarkUtils $status .= vsprintf( t( 'was successfully processed in %d seconds: ' - .'%d links imported, %d links overwritten, %d links skipped.' + . '%d links imported, %d links overwritten, %d links skipped.' ), [$duration, $importCount, $overwriteCount, $skipCount] ); @@ -95,11 +102,11 @@ class NetscapeBookmarkUtils /** * Imports Web bookmarks from an uploaded Netscape bookmark dump * - * @param array $post Server $_POST parameters - * @param array $files Server $_FILES parameters - * @param LinkDB $linkDb Loaded LinkDB instance - * @param ConfigManager $conf instance - * @param History $history History instance + * @param array $post Server $_POST parameters + * @param array $files Server $_FILES parameters + * @param LinkDB $linkDb Loaded LinkDB instance + * @param ConfigManager $conf instance + * @param History $history History instance * * @return string Summary of the bookmark import status */ @@ -115,7 +122,7 @@ class NetscapeBookmarkUtils } // Overwrite existing links? - $overwrite = ! empty($post['overwrite']); + $overwrite = !empty($post['overwrite']); // Add tags to all imported links? if (empty($post['default_tags'])) { @@ -138,7 +145,7 @@ class NetscapeBookmarkUtils ); $logger = new Logger( $conf->get('resource.data_dir'), - ! $conf->get('dev.debug') ? LogLevel::INFO : LogLevel::DEBUG, + !$conf->get('dev.debug') ? LogLevel::INFO : LogLevel::DEBUG, [ 'prefix' => 'import.', 'extension' => 'log', @@ -193,7 +200,7 @@ class NetscapeBookmarkUtils } // Add a new link - @ used for UNIX timestamps - $newLinkDate = new DateTime('@'.strval($bkm['time'])); + $newLinkDate = new DateTime('@' . strval($bkm['time'])); $newLinkDate->setTimezone(new DateTimeZone(date_default_timezone_get())); $newLink['created'] = $newLinkDate; $newLink['id'] = $linkDb->getNextId();