From: Alexander Ebert Date: Mon, 22 Aug 2022 15:24:37 +0000 (+0200) Subject: Convert legacy icons X-Git-Tag: 6.0.0_Alpha_1~1024^2~2^2~21 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=af1aade8412b8254e26f90587d8e0b83d0e80cd4;p=GitHub%2FWoltLab%2FWCF.git Convert legacy icons --- diff --git a/wcfsetup/install/files/lib/data/media/ViewableMedia.class.php b/wcfsetup/install/files/lib/data/media/ViewableMedia.class.php index 3b12914abc..7c7ac7aa5c 100644 --- a/wcfsetup/install/files/lib/data/media/ViewableMedia.class.php +++ b/wcfsetup/install/files/lib/data/media/ViewableMedia.class.php @@ -6,6 +6,7 @@ use wcf\data\DatabaseObjectDecorator; use wcf\data\user\UserProfile; use wcf\system\cache\runtime\UserProfileRuntimeCache; use wcf\system\html\output\AmpHtmlOutputProcessor; +use wcf\system\style\FontAwesomeIcon; use wcf\util\FileUtil; use wcf\util\StringUtil; @@ -192,8 +193,13 @@ class ViewableMedia extends DatabaseObjectDecorator } $icon = FileUtil::getIconNameByFilename($this->filename); + if ($icon) { + $icon = "file-{$icon}"; + } else { + $icon = 'file'; + } - return ''; + return FontAwesomeIcon::fromValues($icon, false)->toHtml($size); } /** diff --git a/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueAction.class.php b/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueAction.class.php index 8d62242f06..c26ac335ec 100644 --- a/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueAction.class.php +++ b/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueAction.class.php @@ -116,7 +116,7 @@ class ModerationQueueAction extends AbstractDatabaseObjectAction $items = \array_map(static function (ViewableModerationQueue $queue) { return [ 'content' => $queue->getAffectedObject()->getTitle(), - 'image' => '', + 'image' => $queue->getIcon()->toHtml(48), 'isUnread' => $queue->isNew(), 'link' => $queue->getLink(), 'objectId' => $queue->queueID, diff --git a/wcfsetup/install/files/lib/data/moderation/queue/ViewableModerationQueue.class.php b/wcfsetup/install/files/lib/data/moderation/queue/ViewableModerationQueue.class.php index 72902431cd..d49e44528e 100644 --- a/wcfsetup/install/files/lib/data/moderation/queue/ViewableModerationQueue.class.php +++ b/wcfsetup/install/files/lib/data/moderation/queue/ViewableModerationQueue.class.php @@ -12,6 +12,7 @@ use wcf\data\user\UserProfile; use wcf\system\bbcode\SimpleMessageParser; use wcf\system\cache\runtime\UserProfileRuntimeCache; use wcf\system\moderation\queue\ModerationQueueManager; +use wcf\system\style\FontAwesomeIcon; use wcf\system\visitTracker\VisitTracker; use wcf\system\WCF; @@ -231,20 +232,20 @@ class ViewableModerationQueue extends DatabaseObjectDecorator implements ILinkab } /** - * @since 5.5 + * @since 6.0 */ - public function getIconName(): string + public function getIcon(): FontAwesomeIcon { $definition = ObjectTypeCache::getInstance()->getDefinition(ObjectTypeCache::getInstance()->getObjectType($this->objectTypeID)->definitionID); if ($definition->definitionName === 'com.woltlab.wcf.moderation.activation') { if ($this->getAffectedObject()->enableTime) { - return 'fa-clock-o'; + return FontAwesomeIcon::fromValues('clock'); } else { - return 'fa-check-square-o'; + return FontAwesomeIcon::fromValues('square-check'); } } - return 'fa-exclamation-triangle'; + return FontAwesomeIcon::fromValues('triangle-exclamation'); } } diff --git a/wcfsetup/install/files/lib/data/user/UserAction.class.php b/wcfsetup/install/files/lib/data/user/UserAction.class.php index a43fced14d..770b105441 100644 --- a/wcfsetup/install/files/lib/data/user/UserAction.class.php +++ b/wcfsetup/install/files/lib/data/user/UserAction.class.php @@ -24,6 +24,7 @@ use wcf\system\exception\UserInputException; use wcf\system\language\LanguageFactory; use wcf\system\request\RequestHandler; use wcf\system\session\SessionHandler; +use wcf\system\style\FontAwesomeIcon; use wcf\system\user\group\assignment\UserGroupAssignmentHandler; use wcf\system\WCF; use wcf\util\UserRegistrationUtil; @@ -575,7 +576,7 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio $pos = \mb_strripos($groupName, $searchString); if ($pos !== false && $pos == 0) { $list[] = [ - 'icon' => '', + 'icon' => FontAwesomeIcon::fromValues('users')->toHtml(16), 'label' => $groupName, 'objectID' => $group->groupID, 'type' => 'group', diff --git a/wcfsetup/install/files/lib/data/user/menu/item/UserMenuItem.class.php b/wcfsetup/install/files/lib/data/user/menu/item/UserMenuItem.class.php index 443d4eb722..48ee2873ed 100644 --- a/wcfsetup/install/files/lib/data/user/menu/item/UserMenuItem.class.php +++ b/wcfsetup/install/files/lib/data/user/menu/item/UserMenuItem.class.php @@ -162,6 +162,6 @@ class UserMenuItem extends ProcessibleDatabaseObject implements ITitledObject, I return FontAwesomeIcon::fromString($this->iconClassName); } - return FontAwesomeIcon::fromValues('bars', false); + return FontAwesomeIcon::fromValues('bars'); } } diff --git a/wcfsetup/install/files/lib/data/user/notification/UserNotificationAction.class.php b/wcfsetup/install/files/lib/data/user/notification/UserNotificationAction.class.php index ae9bd8b917..4fab75bb51 100644 --- a/wcfsetup/install/files/lib/data/user/notification/UserNotificationAction.class.php +++ b/wcfsetup/install/files/lib/data/user/notification/UserNotificationAction.class.php @@ -8,6 +8,7 @@ use wcf\data\user\UserProfile; use wcf\system\database\util\PreparedStatementConditionBuilder; use wcf\system\exception\PermissionDeniedException; use wcf\system\request\LinkHandler; +use wcf\system\style\FontAwesomeIcon; use wcf\system\user\notification\event\IUserNotificationEvent; use wcf\system\user\notification\UserNotificationHandler; use wcf\system\user\storage\UserStorageHandler; @@ -206,7 +207,7 @@ class UserNotificationAction extends AbstractDatabaseObjectAction if ($notificationData['authors'] === 1) { $image = $event->getAuthor()->getAvatar()->getImageTag(48); } else { - $image = ''; + $image = FontAwesomeIcon::fromValues('users')->toHtml(48); } if ($event->isConfirmed()) { diff --git a/wcfsetup/install/files/lib/system/style/FontAwesomeIcon.class.php b/wcfsetup/install/files/lib/system/style/FontAwesomeIcon.class.php index 4eeac58e66..93be797f3d 100644 --- a/wcfsetup/install/files/lib/system/style/FontAwesomeIcon.class.php +++ b/wcfsetup/install/files/lib/system/style/FontAwesomeIcon.class.php @@ -96,7 +96,7 @@ final class FontAwesomeIcon implements \Stringable return new FontAwesomeIcon($name, $forceSolid); } - public static function fromValues(string $name, bool $forceSolid): self + public static function fromValues(string $name, bool $forceSolid = false): self { self::validateName($name); diff --git a/wcfsetup/install/files/lib/system/template/plugin/IconFunctionTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/IconFunctionTemplatePlugin.class.php index ac23755e95..da05723ed0 100644 --- a/wcfsetup/install/files/lib/system/template/plugin/IconFunctionTemplatePlugin.class.php +++ b/wcfsetup/install/files/lib/system/template/plugin/IconFunctionTemplatePlugin.class.php @@ -2,6 +2,7 @@ namespace wcf\system\template\plugin; +use wcf\system\style\FontAwesomeIcon; use wcf\system\template\TemplateEngine; use wcf\util\JSON; @@ -69,13 +70,7 @@ final class IconFunctionTemplatePlugin implements IFunctionTemplatePlugin HTML; } - $modifier = ''; - if ($type === 'solid') { - $modifier = ' solid'; - } - - return << - HTML; + $forceSolid = $type === 'solid'; + return FontAwesomeIcon::fromValues($name, $forceSolid)->toHtml($size); } } diff --git a/wcfsetup/install/files/lib/system/template/plugin/PagesFunctionTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/PagesFunctionTemplatePlugin.class.php index 402910aa2f..729138d397 100644 --- a/wcfsetup/install/files/lib/system/template/plugin/PagesFunctionTemplatePlugin.class.php +++ b/wcfsetup/install/files/lib/system/template/plugin/PagesFunctionTemplatePlugin.class.php @@ -94,9 +94,11 @@ class PagesFunctionTemplatePlugin implements IFunctionTemplatePlugin return '' . "\n"; + ) . '" title="' . WCF::getLanguage()->getDynamicVariable('wcf.global.page.previous') . '" class="jsTooltip" rel="prev"> + + ' . "\n"; } else { - return '' . "\n"; + return '' . "\n"; } } @@ -114,9 +116,11 @@ class PagesFunctionTemplatePlugin implements IFunctionTemplatePlugin return '' . "\n"; + ) . '" title="' . WCF::getLanguage()->getDynamicVariable('wcf.global.page.next') . '" class="jsTooltip" rel="next"> + + ' . "\n"; } else { - return '' . "\n"; + return '' . "\n"; } }