From 295d811f8f44e380ccc99653d7abed3999d31616 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Wed, 13 Nov 2013 12:56:57 +0100 Subject: [PATCH] Added importer for smiley categories --- com.woltlab.wcf/objectType.xml | 5 ++++ .../importer/SmileyCategoryImporter.class.php | 28 +++++++++++++++++++ .../system/importer/SmileyImporter.class.php | 3 ++ 3 files changed, 36 insertions(+) create mode 100644 wcfsetup/install/files/lib/system/importer/SmileyCategoryImporter.class.php diff --git a/com.woltlab.wcf/objectType.xml b/com.woltlab.wcf/objectType.xml index 3226a06550..0824bfb07d 100644 --- a/com.woltlab.wcf/objectType.xml +++ b/com.woltlab.wcf/objectType.xml @@ -272,6 +272,11 @@ com.woltlab.wcf.importer + + com.woltlab.wcf.smiley.category + com.woltlab.wcf.importer + + diff --git a/wcfsetup/install/files/lib/system/importer/SmileyCategoryImporter.class.php b/wcfsetup/install/files/lib/system/importer/SmileyCategoryImporter.class.php new file mode 100644 index 0000000000..4c3f48d312 --- /dev/null +++ b/wcfsetup/install/files/lib/system/importer/SmileyCategoryImporter.class.php @@ -0,0 +1,28 @@ + + * @package com.woltlab.wcf + * @subpackage system.importer + * @category Community Framework + */ +class SmileyCategoryImporter extends AbstractCategoryImporter { + /** + * @see \wcf\system\importer\AbstractCommentImporter::$objectTypeName + */ + protected $objectTypeName = 'com.woltlab.wcf.smiley.category'; + + /** + * Creates a new SmileyCategoryImporter object. + */ + public function __construct() { + $objectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.category', 'com.woltlab.wcf.bbcode.smiley'); + $this->objectTypeID = $objectType->objectTypeID; + } +} diff --git a/wcfsetup/install/files/lib/system/importer/SmileyImporter.class.php b/wcfsetup/install/files/lib/system/importer/SmileyImporter.class.php index 72d5248f4c..09cd00f91e 100644 --- a/wcfsetup/install/files/lib/system/importer/SmileyImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/SmileyImporter.class.php @@ -73,6 +73,9 @@ class SmileyImporter extends AbstractImporter { $data['aliases'] = implode("\n", $aliases); } + // get category id + if (!empty($data['categoryID'])) $data['categoryID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.smiley.category', $data['categoryID']); + // save smiley $smiley = SmileyEditor::create($data); -- 2.20.1