summaryrefslogtreecommitdiff
path: root/modules/g2_import/helpers/g2_import.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules/g2_import/helpers/g2_import.php')
-rw-r--r--modules/g2_import/helpers/g2_import.php20
1 files changed, 18 insertions, 2 deletions
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php
index bea0328e..482f4089 100644
--- a/modules/g2_import/helpers/g2_import.php
+++ b/modules/g2_import/helpers/g2_import.php
@@ -236,7 +236,6 @@ class g2_import_Core {
$album->view_count = g2(GalleryCoreApi::fetchItemViewCount($g2_album_id));
$album->created = $g2_album->getCreationTimestamp();
- // @todo support "keywords", "originationTimestamp", and "random" sort orders.
$order_map = array(
"originationTimestamp" => "captured",
"creationTimestamp" => "created",
@@ -256,9 +255,9 @@ class g2_import_Core {
}
$album->save();
+ self::import_keywords_as_tags($g2_album->getKeywords(), $album);
self::set_map($g2_album_id, $album->id);
- // @todo import keywords as tags
// @todo import album highlights
}
@@ -304,6 +303,10 @@ class g2_import_Core {
break;
}
+ if (!empty($item)) {
+ self::import_keywords_as_tags($g2_item->getKeywords(), $item);
+ }
+
if (isset($item)) {
self::set_map($g2_item_id, $item->id);
}
@@ -355,6 +358,19 @@ class g2_import_Core {
// have an id for each individual tag mapping anyway so it'd be hard to set up the mapping.
}
+ static function import_keywords_as_tags($keywords, $item) {
+ if (!module::is_installed("tag")) {
+ return;
+ }
+
+ foreach (preg_split("/[,;]/", $keywords) as $keyword) {
+ $keyword = trim($keyword);
+ if ($keyword) {
+ tag::add($item, $keyword);
+ }
+ }
+ }
+
/**
* If the thumbnails and resizes created for the Gallery2 photo match the dimensions of the
* ones we expect to create for Gallery3, then copy the files over instead of recreating them.