{icon name='face-frown' size=32}
</span>
<span class="contentNotVisible__title">
- {if $message|isset}{@$message}{else}{lang}wcf.message.content.not.available.title{/lang}{/if}
+ {unsafe:$message}
</span>
</div>
use wcf\data\attachment\Attachment;
use wcf\system\message\embedded\object\MessageEmbeddedObjectManager;
use wcf\system\style\FontAwesomeIcon;
+use wcf\system\view\ContentNotVisibleView;
use wcf\system\WCF;
use wcf\util\StringUtil;
$attachment = $this->getAttachment($attachmentID);
if ($attachment === null) {
- return WCF::getTPL()->fetch('shared_contentNotVisible', sandbox: true);
+ return new ContentNotVisibleView();
}
$outputType = $parser->getOutputType();
} elseif (\substr($attachment->fileType, 0, 6) === 'audio/' && $outputType == 'text/html') {
return $this->showAudioPlayer($attachment);
} elseif (!$attachment->canDownload()) {
- return WCF::getTPL()->fetch('shared_contentNotVisible', 'wcf', [
- 'message' => WCF::getLanguage()->getDynamicVariable('wcf.message.content.no.permission.title')
- ], true);
+ return new ContentNotVisibleView(
+ WCF::getLanguage()->getDynamicVariable('wcf.message.content.no.permission.title')
+ );
}
return StringUtil::getAnchorTag($attachment->getLink(), $attachment->filename);
use wcf\data\article\ViewableArticle;
use wcf\system\message\embedded\object\MessageEmbeddedObjectManager;
+use wcf\system\view\ContentNotVisibleView;
use wcf\system\WCF;
use wcf\util\StringUtil;
$article = $this->getArticle($articleID);
if ($article === null) {
- return WCF::getTPL()->fetch('shared_contentNotVisible', sandbox: true);
+ return new ContentNotVisibleView();
}
if (!$article->canRead()) {
- return WCF::getTPL()->fetch('shared_contentNotVisible', 'wcf', [
- 'message' => WCF::getLanguage()->getDynamicVariable('wcf.message.content.no.permission.title')
- ], true);
+ return new ContentNotVisibleView(
+ WCF::getLanguage()->getDynamicVariable('wcf.message.content.no.permission.title')
+ );
} elseif ($parser->getOutputType() == 'text/html') {
return WCF::getTPL()->fetch('shared_bbcode_wsa', 'wcf', [
'article' => $article,
use wcf\data\media\ViewableMedia;
use wcf\system\message\embedded\object\MessageEmbeddedObjectManager;
+use wcf\system\view\ContentNotVisibleView;
use wcf\system\WCF;
use wcf\util\StringUtil;
/** @var ViewableMedia $media */
$media = MessageEmbeddedObjectManager::getInstance()->getObject('com.woltlab.wcf.media', $mediaID);
if ($media === null) {
- return WCF::getTPL()->fetch('shared_contentNotVisible', sandbox: true);
+ return new ContentNotVisibleView();
}
if ($media->isAccessible()) {
return StringUtil::encodeHTML($media->getLink());
} else {
- return WCF::getTPL()->fetch('shared_contentNotVisible', 'wcf', [
- 'message' => WCF::getLanguage()->getDynamicVariable('wcf.message.content.no.permission.title')
- ], true);
+ return new ContentNotVisibleView(
+ WCF::getLanguage()->getDynamicVariable('wcf.message.content.no.permission.title')
+ );
}
}
}
use wcf\data\page\Page;
use wcf\system\message\embedded\object\MessageEmbeddedObjectManager;
-use wcf\system\WCF;
+use wcf\system\view\ContentNotVisibleView;
use wcf\util\StringUtil;
/**
return StringUtil::getAnchorTag($page->getLink(), $title ?: $page->getTitle());
}
- return WCF::getTPL()->fetch('shared_contentNotVisible', sandbox: true);
+ return new ContentNotVisibleView();
}
}
--- /dev/null
+<?php
+
+namespace wcf\system\view;
+
+use wcf\system\WCF;
+
+/**
+ * Represents the view for a 'content not visible' block.
+ *
+ * @author Marcel Werk
+ * @copyright 2001-2024 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since 6.1
+ */
+final class ContentNotVisibleView
+{
+ private readonly string $message;
+
+ public function __construct(
+ string $message = '',
+ ) {
+ if (!$message) {
+ $message = WCF::getLanguage()->get('wcf.message.content.not.available.title');
+ }
+
+ $this->message = $message;
+ }
+
+ public function __toString(): string
+ {
+ return WCF::getTPL()->fetch('shared_contentNotVisible', 'wcf', [
+ 'message' => $this->message,
+ ], true);
+ }
+}