本文整理汇总了PHP中TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::fileResource方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentObjectRenderer::fileResource方法的具体用法?PHP ContentObjectRenderer::fileResource怎么用?PHP ContentObjectRenderer::fileResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
的用法示例。
在下文中一共展示了ContentObjectRenderer::fileResource方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editAction
/**
*
* Displays a form for editing or creating a single forum.
*
* @access private
* @return String HTML content
*/
function editAction()
{
$forumUid = $this->v['newForum'] ? -1 : intval($this->v['editForum']);
if ($this->v['forum']['save']) {
$result = $this->saveEditAction();
if ($result['success'] === TRUE) {
$this->redirectToAction(array('flashmessage' => base64_encode(sprintf($this->l('edit-success'), $this->v['forum']['name']))));
} else {
$errors = $result['errors'];
}
} elseif ($this->v['forum']['cancel']) {
$this->redirectToAction(array());
} else {
$errors = array();
}
$template = $this->cObj->fileResource($this->conf['templates.']['edit']);
# Select the forum to be edited. The "hidden" flag is not queried on purpose!
if ($forumUid > 0) {
$res = $this->databaseHandle->exec_SELECTquery('uid, forum_name AS name, forum_desc AS description, parentID AS parent', 'tx_mmforum_forums', 'uid=' . $forumUid . ' AND deleted=0 ' . $this->p->getStoragePIDQuery());
if ($this->databaseHandle->sql_num_rows($res) == 0) {
return $this->p->errorMessage($this->p->conf, $this->l('error-forumnotfound'));
}
$forumArray = $this->databaseHandle->sql_fetch_assoc($res);
} else {
$forumArray = array();
}
if (is_array($this->v['forum'])) {
$forumArray = array_merge($forumArray, $this->v['forum']);
}
if (!$forumArray['name']) {
$forumArray['name'] = $this->l('new-dummytitle');
}
if (!$this->checkActionAllowance($forumArray['parent'] == 0 ? 'category' : 'forum', $forumUid == -1 ? 'create' : 'edit')) {
return $this->displayNoAccessError();
}
$forumMarkers = array('###FORUM_NAME###' => $this->validator->specialChars($forumArray['name']), '###FORUM_DESCRIPTION###' => $this->validator->specialChars($forumArray['description']), '###FORUM_PARENT_OPTIONS###' => $this->getForumSelectOptionList($forumArray['parent']), '###FORUM_HIDDEN_CHECKED###' => $forumArray['hidden'] ? 'checked="checked"' : '', '###FORUM_UID###' => $forumUid, '###FORM_ACTION###' => $this->p->pi_getPageLink($GLOBALS['TSFE']->id));
foreach (array('name', 'description', 'parent') as $field) {
if ($errors[$field]) {
$messages = array();
foreach ($errors[$field] as $error) {
$messages[] = vsprintf($this->l('error-' . $field . '-' . $error['type']), $error['args']);
}
$forumMarkers['###ERRORS_' . strtoupper($field) . '###'] = $this->cObj->stdWrap(implode(' ', $messages), $this->conf['format.']['errorMessage.']);
} else {
$forumMarkers['###ERRORS_' . strtoupper($field) . '###'] = '';
}
}
$template = $this->cObj->substituteMarkerArray($template, $forumMarkers);
$template = preg_replace_callback('/###L:([A-Z_-]+)###/i', array($this, 'replaceLL'), $template);
return $template;
}
示例2: array
/**
* Outputs information about a specific user for the post listing.
* @param int $uid The UID of the user whose information are to be displayed
* @param array $conf The configuration vars of the plugin
* @param bool $threadauthor TRUE, if the user is the author of the thread displayed. In
* this case, a special string telling that this user is the author
* of the thread is displayed.
* @return string The user information
*/
function ident_user($uid, $conf, $threadauthor = FALSE)
{
$userData = !is_array($uid) ? tx_mmforum_tools::get_userdata($uid) : $uid;
$template = $this->cObj->fileResource($this->conf['template.']['list_post']);
$template = $this->cObj->getSubpart($template, '###USERINFO###');
if ($template) {
$avatar = $this->getUserAvatar($userData);
$marker = array('###LLL_DELETED###' => $this->pi_getLL('user-deleted'), '###USERNAME###' => $this->cObj->stdWrap($userData[$this->getUserNameField()], $this->conf['list_posts.']['userinfo.']['username_stdWrap.']), '###USERREALNAME###' => $this->cObj->stdWrap($userData['name'], $this->conf['list_posts.']['userinfo.']['realname_stdWrap.']), '###USERRANKS###' => $this->get_userranking($uid, $conf), '###TOPICCREATOR###' => $uid == $threadauthor ? $this->cObj->stdWrap($this->pi_getLL('topic-topicauthor'), $this->conf['list_posts.']['userinfo.']['creator_stdWrap.']) : '', '###AVATAR###' => $avatar, '###LLL_REGSINCE###' => $this->pi_getLL('user-regSince'), '###LLL_POSTCOUNT###' => $this->pi_getLL('user-posts'), '###REGSINCE###' => $this->cObj->stdWrap($userData['crdate'], $this->conf['list_posts.']['userinfo.']['crdate_stdWrap.']), '###POSTCOUNT###' => intval($userData['tx_mmforum_posts']), '###USER_RATING###' => $this->isUserRating() ? $this->getRatingDisplay('fe_users', $userData['uid']) : '');
if ($userData === false) {
$template = $this->cObj->substituteSubpart($template, '###USERINFO_REGULAR###', '');
} else {
$template = $this->cObj->substituteSubpart($template, '###USERINFO_DELETED###', '');
}
// Include hooks
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['userInformation_marker'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['userInformation_marker'] as $_classRef) {
$_procObj =& GeneralUtility::getUserObj($_classRef);
$marker = $_procObj->userInformation_marker($marker, $userData, $this);
}
}
$content = $this->cObj->substituteMarkerArray($template, $marker);
} else {
if ($userData === false) {
return '<strong>' . $this->pi_getLL('user.deleted') . '</strong>';
}
$content = '<strong>' . $userData[$this->getUserNameField()] . '</strong><br />';
if ($this->conf['list_posts.']['userinfo_realName'] && $userData['name']) {
$content .= $this->cObj->wrap($userData['name'], $this->conf['list_posts.']['userinfo_realName_wrap']);
}
$userranking = $this->get_userranking($uid, $conf) . '<br />';
if ($uid == $threadauthor) {
$userranking .= $this->cObj->wrap($this->pi_getLL('topic.topicauthor'), $this->conf['list_posts.']['userinfo_topicauthor_wrap']);
}
$content .= $userranking;
if ($userData['tx_mmforum_avatar']) {
$content .= $this->tools->res_img($conf['path_avatar'] . $userData['tx_mmforum_avatar'], $conf['avatar_height'], $conf['avatar_width']);
}
$content .= $this->cObj->wrap($this->pi_getLL('user.regSince') . ': ' . date('d.m.Y', $userData['crdate']) . '<br />' . $this->pi_getLL('user.posts') . ': ' . $userData['tx_mmforum_posts'], $this->conf['list_posts.']['userinfo_content_wrap']);
}
return $content;
}
示例3: array
/**
* Displays the post queue.
* This function displays all elements of the postqueue in a list
* view.
*
* @author Martin Helmich
* @version 2007-07-21
* @return string The postqueue list content
*/
function display_postQueue()
{
$template = $this->cObj->fileResource($this->conf['template.']['postqueue']);
$template = $this->cObj->getSubpart($template, '###POSTQUEUE_LIST###');
$template_row = $this->cObj->getSubpart($template, '###POSTQUEUE_ITEM###');
$marker = array('###LLL_PUBLISH###' => $this->pi_getLL('postqueue.publishtab'), '###LLL_DELETE###' => $this->pi_getLL('postqueue.deletetab'), '###LLL_IGNORE###' => $this->pi_getLL('postqueue.ignoretab'), '###LLL_POSTTEXT###' => $this->pi_getLL('postqueue.posttext'), '###LLL_POSTQUEUE###' => $this->pi_getLL('postqueue.title'), '###LLL_PUBLISHBUTTON###' => $this->pi_getLL('postqueue.publishbutton'), '###LLL_NOITEMS###' => $this->pi_getLL('postqueue.noitems'), '###ACTION###' => $this->parent->escapeURL($this->parent->pi_getPageLink($GLOBALS['TSFE']->id)));
$template = $this->cObj->substituteMarkerArray($template, $marker);
$rContent = '';
$boards = $this->getModeratorBoards();
if (is_array($boards)) {
$res = $this->databaseHandle->exec_SELECTquery('q.*', 'tx_mmforum_postqueue q LEFT JOIN tx_mmforum_topics t ON q.post_parent = t.uid', 'q.deleted = 0 AND (t.deleted=0 OR t.uid IS NULL) AND (q.topic_forum IN (' . implode(',', $boards) . ') OR t.forum_id IN (' . implode(',', $boards) . '))', '', 'q.crdate DESC');
} elseif ($boards === true) {
$res = $this->databaseHandle->exec_SELECTquery('*', 'tx_mmforum_postqueue', 'deleted=0', '', 'crdate DESC');
}
if ($boards !== false) {
if ($this->databaseHandle->sql_num_rows($res) > 0) {
$template = $this->cObj->substituteSubpart($template, '###POSTQUEUE_NOITEMS###', '');
} else {
$template = $this->cObj->substituteSubpart($template, '###POSTQUEUE_ITEMLIST###', '');
}
while ($arr = $this->databaseHandle->sql_fetch_assoc($res)) {
$rMarker = array('###LLL_WROTE###' => $this->pi_getLL('postqueue.wrote'), '###DATE###' => $this->parent->formatDate($arr['post_time']), '###POST_TEXT###' => $this->tx_mmforum_postparser->main($this->parent, $this->conf, $this->parent->escape($arr['post_text']), 'textparser'), '###UID###' => $arr['uid'], '###POST_POSTER###' => $this->parent->linkToUserProfile($arr['post_user']), '###CHECK_DELETE###' => '', '###CHECK_IGNORE###' => $arr['hidden'] ? 'checked="checked"' : '', '###CHECK_PUBLISH###' => $arr['hidden'] ? '' : 'checked="checked"', '###FORUMPATH###' => $this->getForumLink($arr['topic_forum']));
if ($arr['topic']) {
$rMarker['###TOPIC_LINK###'] = $this->parent->escape($arr['topic_title']) . ' [' . $this->pi_getLL('postqueue.newTopic') . ']';
} else {
$tData = $this->parent->getTopicData($arr['post_parent']);
$linkParams[$this->parent->prefixId] = array('action' => 'list_post', 'tid' => $tData['uid']);
if ($this->parent->getIsRealURL()) {
$linkParams[$this->parent->prefixId]['fid'] = $tData['forum_id'];
}
$rMarker['###TOPIC_LINK###'] = $this->parent->pi_linkToPage($this->parent->escape($tData['topic_title']), $this->conf['pid_forum'], '', $linkParams);
}
$rContent .= $this->cObj->substituteMarkerArray($template_row, $rMarker);
}
$template = $this->cObj->substituteSubpart($template, '###POSTQUEUE_ITEM###', $rContent);
} else {
$template = $this->cObj->substituteSubpart($template, '###POSTQUEUE_ITEMLIST###', '');
}
return $template;
}
示例4: objDisplay
/**
* Display a poll.
* This function displays a poll. Depending on whether the user that is
* currently logged in is allowed to vote on this poll (this will be the
* case if the user has not already voted in this poll and if the poll is
* not yet expired), the user will see a set of radio buttons allowing him/her
* to choose an answering possibility, or the poll results.
*
* @return string The poll content
* @version 2007-05-22
*/
function objDisplay()
{
if ($this->piVars['poll']['vote'] == '1') {
$this->objVote();
}
$template = $this->cObj->fileResource($this->conf['template.']['polls']);
$template = $this->cObj->getSubpart($template, '###POLL_DISPLAY###');
$vote = $this->getMayVote();
if (!$vote) {
$template = $this->cObj->substituteSubpart($template, '###POLL_SUBMIT###', '');
$row_template = $this->cObj->getSubpart($template, '###POLL_ANSWER_2###');
} else {
$row_template = $this->cObj->getSubpart($template, '###POLL_ANSWER_1###');
}
$res = $this->databaseHandle->exec_SELECTquery('*', 'tx_mmforum_polls_answers', 'poll_id=' . intval($this->data['uid']) . ' AND deleted=0');
$i = 1;
$aContent = '';
while ($arr = $this->databaseHandle->sql_fetch_assoc($res)) {
$pAnswers = $arr['votes'] > 0 ? round($arr['votes'] / $this->data['votes'] * 100) : 0;
if ($this->conf['polls.']['pollBar_colorMap.'][$i]) {
$color = $this->conf['polls.']['pollBar_colorMap.'][$i];
} else {
$color = $this->conf['polls.']['pollBar_colorMap.']['default'];
}
$aMarker = array('###ANSWER_UID###' => $arr['uid'], '###ANSWER_TEXT###' => $this->p->escape($arr['answer']), '###ANSWER_COUNT###' => sprintf($this->p->pi_getLL('poll.replies'), $arr['votes'], $this->data['votes'], $pAnswers . '%'), '###ANSWER_ANSWERS###' => '<div style="width: ' . $pAnswers . '%; height:10px; background-color: ' . $color . ';"> </div>', '###ENABLE###' => '');
$aContent .= $this->cObj->substituteMarkerArray($row_template, $aMarker);
$i++;
}
$actionParams[$this->p->prefixId] = array('tid' => $this->p->piVars['tid'], 'fid' => $this->p->piVars['fid'], 'action' => 'list_post');
$actionLink = $this->p->pi_getPageLink($GLOBALS['TSFE']->id, '', $actionParams);
$marker = array('###LABEL_POLL###' => $this->p->pi_getLL('poll.title'), '###LABEL_VOTE###' => $this->p->pi_getLL('poll.vote'), '###LABEL_QUESTION###' => $this->p->pi_getLL('poll.question'), '###QUESTION###' => $this->p->escape($this->data['question']), '###EXPIRES###' => $this->data['endtime'] ? $this->p->pi_getLL('poll.expires') . ' ' . date('d. m. Y, H:i', $this->data['endtime']) : '', '###ACTION###' => $this->p->escapeURL($actionLink), '###ICON###' => $this->cObj->cObjGetSingle($this->conf['polls.']['poll_icon'], $this->conf['polls.']['poll_icon.']));
$marker['###EXPIRES###'] = $this->cObj->stdWrap($marker['###EXPIRES###'], $this->conf['polls.']['expired_stdWrap.']);
$template = $this->cObj->substituteMarkerArray($template, $marker);
$template = $this->cObj->substituteSubpart($template, '###POLL_ANSWER_1###', $aContent);
$template = $this->cObj->substituteSubpart($template, '###POLL_ANSWER_2###', '');
return $template;
}
示例5: printPosts
/**
* Prints an array of posts.
* This function prints an array of posts that are to be listed in the RSS
* feed.
* @param array $posts A numeric array of all posts that shall be listed in the
* RSS
* @return string The RSS feed as XML string
*/
function printPosts($posts)
{
$template = $this->cObj->fileResource($this->conf['template.']['rss']);
$template = $this->cObj->getSubpart($template, '###RSS_FEED###');
$rowTemplate = $this->cObj->getSubpart($template, '###RSS_POST_ITEM###');
// Include hooks
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['rss_posts'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['rss_posts'] as $_classRef) {
$_procObj =& GeneralUtility::getUserObj($_classRef);
$marker = $_procObj->rss_posts($posts, $this);
}
}
// TODO: FIXME undefined variables $mode, $param
$marker = array('###RSS_ENCODING###' => $GLOBALS['TSFE']->renderCharset, '###RSS_TITLE###' => '<![CDATA[' . $this->getFeedTitle($mode, $param) . ']]>', '###RSS_DESCRIPTION###' => $this->getFeedDescription(), '###RSS_URL###' => $this->pObj->escapeURL($this->getFeedURL()), '###RSS_GENERATOR###' => 'mm_forum powered by TYPO3', '###RSS_LASTBUILT###' => date('r'), '###RSS_LANGUAGE###' => $this->pObj->LLkey == 'default' ? 'en' : $this->pObj->LLkey);
// Include hooks
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['rss_globalMarkers'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['rss_globalMarkers'] as $_classRef) {
$_procObj =& GeneralUtility::getUserObj($_classRef);
$marker = $_procObj->rss_globalMarkers($marker, $posts, $this);
}
}
$template = $this->cObj->substituteMarkerArray($template, $marker);
$rowContent = '';
foreach ($posts as $post) {
$rowMarker = array('###RSS_TOPIC_NAME###' => $this->pObj->escape($post['topic_title']), '###RSS_POST_LINK###' => $this->getPostLink($post['post_uid']), '###RSS_POST_DATE###' => date('r', $post['post_time']), '###RSS_POST_TEXT_SHORT###' => $this->getPostTextShort($post['post_text']), '###RSS_POST_TEXT###' => $this->getPostTextComplete($post['post_text']), '###RSS_FORUM_NAME###' => $this->pObj->escape($post['forum_name']), '###RSS_POST_AUTHOR###' => $this->pObj->escape($post[$this->conf['userNameField'] ? $this->conf['userNameField'] : 'username']));
$rowContent .= $this->cObj->substituteMarkerArray($rowTemplate, $rowMarker);
// Include hooks
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['rss_itemMarkers'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['rss_itemMarkers'] as $_classRef) {
$_procObj =& GeneralUtility::getUserObj($_classRef);
$rowMarker = $_procObj->rss_itemMarkers($marker, $post, $this);
}
}
}
$template = $this->cObj->substituteSubpart($template, '###RSS_POST_ITEM###', $rowContent);
return $template;
}
示例6: display
/**
* Displays the plugin
* @author Martin Helmich <m.helmich@mittwald.de>
* @param string $content The plugin content
* @return string The plugin content
* @uses getOnlineGuests
* @uses getTodayGuests
* @uses getOnlineUsers
* @uses getTodayUsers
* @uses getTotalUsers
* @uses getTotalTopics
* @uses getTotalReplies
* @uses getAveragePosts
* @uses getUserList
*/
function display($content)
{
$small = $this->small;
$template = $this->cObj->fileResource($this->conf['templateFile']);
$subpart = !$small ? "###PORTALINFO###" : "###PORTALINFO_SMALL###";
$template = $this->cObj->getSubpart($template, $subpart);
// Determine amount of registered users
$onlineUsers = $this->getOnlineUsers();
$todayUsers = $this->getTodayUsers();
// Determine amount of guests
if (ExtensionManagementUtility::isLoaded('sys_stat')) {
$onlineGuests = $this->getOnlineGuests();
$todayGuests = $this->getTodayGuests();
} else {
$onlineGuests = 0;
$todayGuests = 0;
}
// Determine total amount of visitors
$onlineTotal = $onlineUsers['count'] + $onlineGuests;
$todayTotal = $todayUsers['count'] + $todayGuests;
// Current users
$llMarker = array('###PRD###' => $this->getSgPl('prd.pr', $onlineTotal ? $onlineTotal : $onlineUsers['count']), '###BESUCHER_TOTAL###' => $this->cObj->wrap($onlineTotal ? $onlineTotal : 0, $this->conf['importantInformation_wrap']), '###BESUCHER_TOTAL_LABEL###' => $this->getSgPl('total_user', $onlineTotal ? $onlineTotal : $onlineUsers['count']), '###BESUCHER_REG###' => $this->cObj->wrap($onlineUsers['count'], $this->conf['importantInformation_wrap']), '###BESUCHER_REG_LABEL###' => $this->getSgPl('reg_user', $onlineUsers['count']), '###BESUCHER_GAST###' => $this->cObj->wrap($onlineGuests, $this->conf['importantInformation_wrap']), '###BESUCHER_GAST_LABEL###' => $this->getSgPl('guest', $onlineGuests));
$currentTotal = $this->cObj->substituteMarkerArray($this->pi_getLL('info.currentTotal'), $llMarker);
// Today's users
$llMarker = array('###PRD###' => $this->getSgPl('prd.vg', $todayTotal ? $todayTotal : $todayUsers['count']), '###BESUCHER_REG_HEUTE###' => $this->cObj->wrap($todayUsers['count'], $this->conf['importantInformation_wrap']), '###BESUCHER_REG_HEUTE_LABEL###' => $this->getSgPl('reg_user', $todayUsers['count']), '###BESUCHER_GAST_HEUTE###' => $this->cObj->wrap($todayGuests, $this->conf['importantInformation_wrap']), '###BESUCHER_GAST_HEUTE_LABEL###' => $this->getSgPl('guest', $todayGuests));
$todayTotal = $this->cObj->substituteMarkerArray($this->pi_getLL('info.todayTotal'), $llMarker);
// Statistics
$llMarker = array('###BENUTZER_TOTAL###' => $this->cObj->wrap($this->getTotalUsers(), $this->conf['importantInformation_wrap']), '###THEMEN_TOTAL###' => $this->cObj->wrap($this->getTotalTopics(), $this->conf['importantInformation_wrap']), '###ANTWORTEN_TOTAL###' => $this->cObj->wrap($this->getTotalReplies(), $this->conf['importantInformation_wrap']), '###BEITRAEGE_SCHNITT###' => $this->cObj->wrap(round($this->getAveragePosts(), 2), $this->conf['importantInformation_wrap']), '###SITENAME###' => $this->cObj->wrap($this->conf['siteName'], $this->conf['importantInformation_wrap']));
$statistics = $this->cObj->substituteMarkerArray($this->pi_getLL('info.stats'), $llMarker);
$marker = array('###LABEL_INFO###' => $this->pi_getLL('info.title'), '###LABEL_CURRENT_TOTAL###' => $currentTotal, '###LABEL_TODAY_TOTAL###' => $todayTotal, '###LABEL_CURRENTLYONLINE###' => $this->pi_getLL('info.currentlyOnline'), '###LABEL_TODAYONLINE###' => $this->pi_getLL('info.todayOnline'), '###LABEL_STATS###' => $statistics, '###BESUCHER_LISTE###' => $this->getUserList($onlineUsers, TRUE), '###BESUCHER_LISTE_HEUTE###' => !$small ? $this->getUserList($todayUsers, TRUE) : '', '###EXPAND###' => $this->getExpandCollapseLink(TRUE), '###COLLAPSE###' => $this->getExpandCollapseLink(FALSE));
$template = $this->cObj->substituteMarkerArray($template, $marker);
return $content . $template;
}
示例7: successMessage
/**
* Generates a success message.
* @author Martin Helmich <m.helmich@mittwald.de>
* @param array $conf The plugin's configuration vars
* @param string $msg The success message
* @return string The HTML success message
*/
function successMessage($conf, $msg)
{
$template = $this->cObj->fileResource($conf['template.']['login_error']);
$template = $this->cObj->getSubpart($template, '###SUCCESSNOTICE###');
$marker = array();
$marker['###LOGINERROR_MESSAGE###'] = $msg;
return $this->cObj->substituteMarkerArrayCached($template, $marker);
}