本文整理汇总了PHP中TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::substituteMarkerArray方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentObjectRenderer::substituteMarkerArray方法的具体用法?PHP ContentObjectRenderer::substituteMarkerArray怎么用?PHP ContentObjectRenderer::substituteMarkerArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
的用法示例。
在下文中一共展示了ContentObjectRenderer::substituteMarkerArray方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendNotification
/**
* Sends a notification email
*
* @param string $recipients comma-separated list of email addresses that should
* receive the notification
* @param array $config notification configuration
* @param object $media one or multiple media records (QueryResult)
* @param \Exception $exception the exception that was thrown
* @return boolean success status of email
*/
protected function sendNotification($recipients, array $config, $media, \Exception $exception = NULL)
{
// Convert comma-separated list to array
$recipients = array_map('trim', explode(',', $recipients));
// Generate markers for the email subject and content
$markers = array('###SIGNATURE###' => $config['signature']);
if (isset($exception)) {
$markers['###ERROR###'] = $exception->getMessage();
$markers['###ERROR_FILE###'] = $exception->getFile();
$markers['###ERROR_LINE###'] = $exception->getLine();
}
// Generate list of media files for the email
$allMedia = $media instanceof Media ? array($media) : $media->toArray();
$mediaFiles = array();
foreach ($allMedia as $oneMedia) {
// Get all properties of media record that can be outputted
$mediaMarkers = array();
foreach ($oneMedia->toArray() as $key => $value) {
if (!is_object($value)) {
$mediaMarkers[$key] = $value;
}
}
// Provide properties as markers
$mediaFiles[] = $this->cObj->substituteMarkerArray($config['mediafiles'], $mediaMarkers, '###|###', TRUE);
}
$markers['###MEDIAFILES###'] = implode("\n", $mediaFiles);
// Replace markers in subject and content
$subject = $this->cObj->substituteMarkerArray($config['subject'], $markers);
$message = $this->cObj->substituteMarkerArray($config['message'], $markers);
// Send email
return $this->objectManager->get('TYPO3\\CMS\\Core\\Mail\\MailMessage')->setFrom(\TYPO3\CMS\Core\Utility\MailUtility::getSystemFrom())->setTo($recipients)->setSubject($subject)->setBody($message)->send();
}
示例2: generateMail
/**
* This Method generates a Mailcontent with $this->templatecode
* as Mailtemplate. First Line in Template represents the Mailsubject.
* The other required data can be queried from database by Parameters.
*
* @param string $orderUid The uid for the specified Order
* @param array $orderData Contaning additional data like Customer UIDs.
* @param string $templateCode Template code
*
* @return string The built Mailcontent
*/
protected function generateMail($orderUid, array $orderData, $templateCode)
{
$database = $this->getDatabaseConnection();
$markerArray = array('###ORDERID###' => $orderUid);
$content = $this->cObj->getSubpart($templateCode, '###MAILCONTENT###');
// Get The addresses
$deliveryAdress = '';
if ($orderData['cust_deliveryaddress']) {
$data = $database->exec_SELECTgetSingleRow('*', 'tt_address', 'uid = ' . (int) $orderData['cust_deliveryaddress']);
if (is_array($data)) {
$deliveryAdress = $this->makeAdressView($data, '###DELIVERY_ADDRESS###', $content);
}
}
$content = $this->cObj->substituteSubpart($content, '###DELIVERY_ADDRESS###', $deliveryAdress);
$billingAdress = '';
if ($orderData['cust_invoice']) {
$data = $database->exec_SELECTgetSingleRow('*', 'tt_address', 'uid = ' . (int) $orderData['cust_invoice']);
if (is_array($data)) {
$billingAdress = $this->makeAdressView($data, '###BILLING_ADDRESS###', $content);
$this->customermailadress = $data['email'];
}
}
$content = $this->cObj->substituteSubpart($content, '###BILLING_ADDRESS###', $billingAdress);
$content = $this->cObj->substituteSubpart($content, '###INVOICE_VIEW###', '');
/*
* Hook for processing Marker Array
*/
$hookObject = \CommerceTeam\Commerce\Factory\HookFactory::getHook('Hook/OrdermailHooks', 'generateMail');
if (is_object($hookObject) && method_exists($hookObject, 'processMarker')) {
$markerArray = $hookObject->processMarker($markerArray, $this);
}
$content = $this->cObj->substituteMarkerArray($content, $markerArray);
// Since The first line of the mail is the Subject, trim the template
return ltrim($content);
}
示例3: generateMail
/**
* This Method generates a Mailcontent with $this->templatecode
* as Mailtemplate. First Line in Template represents the Mailsubject.
* The other required data can be queried from database by Parameters.
*
* @param string $orderUid The uid for the specified Order
* @param array $orderData Contaning additional data like Customer UIDs.
* @param string $templateCode Template code
*
* @return string The built Mailcontent
*/
protected function generateMail($orderUid, array $orderData, $templateCode)
{
$database = $this->getDatabaseConnection();
$markerArray = array();
$markerArray['###ORDERID###'] = $orderUid;
/**
* Since The first line of the mail is the Subject, trim the template
*/
$content = ltrim($this->cObj->getSubpart($templateCode, '###MAILCONTENT###'));
// Get The addresses
$deliveryAdress = '';
if ($orderData['cust_deliveryaddress']) {
$data = $database->exec_SELECTgetSingleRow('*', 'tt_address', 'uid=' . (int) $orderData['cust_deliveryaddress']);
if (is_array($data)) {
$deliveryAdress = $this->makeAdressView($data, '###DELIVERY_ADDRESS###');
}
}
$content = $this->cObj->substituteSubpart($content, '###DELIVERY_ADDRESS###', $deliveryAdress);
$billingAdress = '';
if ($orderData['cust_invoice']) {
$data = $database->exec_SELECTgetSingleRow('*', 'tt_address', 'uid=' . (int) $orderData['cust_invoice']);
if (is_array($data)) {
$billingAdress = $this->makeAdressView($data, '###BILLING_ADDRESS###');
$this->customermailadress = $data['email'];
}
}
$content = $this->cObj->substituteSubpart($content, '###BILLING_ADDRESS###', $billingAdress);
$invoicelist = '';
$content = $this->cObj->substituteSubpart($content, '###INVOICE_VIEW###', $invoicelist);
/**
* Hook for processing Marker Array
*/
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce_ordermails/mod1/class.tx_commerce_moveordermail.php']['generateMail'])) {
GeneralUtility::deprecationLog('
hook
$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'commerce_ordermails/mod1/class.tx_commerce_moveordermail.php\'][\'generateMail\']
is deprecated since commerce 1.0.0, it will be removed in commerce 1.4.0, please use instead
$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'commerce/Classes/Hook/OrdermailHooks.php\'][\'generateMail\']
');
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce_ordermails/mod1/class.tx_commerce_moveordermail.php']['generateMail'] as $classRef) {
$hookObj = GeneralUtility::getUserObj($classRef);
if (method_exists($hookObj, 'ProcessMarker')) {
$markerArray = $hookObj->ProcessMarker($markerArray, $this);
}
}
}
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/Classes/Hook/OrdermailHooks.php']['generateMail'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/Classes/Hook/OrdermailHooks.php']['generateMail'] as $classRef) {
$hookObj = GeneralUtility::getUserObj($classRef);
if (method_exists($hookObj, 'ProcessMarker')) {
$markerArray = $hookObj->ProcessMarker($markerArray, $this);
}
}
}
$content = $this->cObj->substituteMarkerArray($content, $markerArray);
return ltrim($content);
}
示例4: extraCodesProcessor
/**
* Main function, called from TypoScript
* A content object that renders "tt_content" records. See the comment to this class for TypoScript example of how to trigger it.
* This detects the CType of the current content element and renders it accordingly. Only wellknown types are rendered.
*
* @param \TYPO3\CMS\Frontend\Plugin\AbstractPlugin $invokingObj the tt_news object
* @return string Plain text content
*/
public function extraCodesProcessor(&$invokingObj)
{
$content = '';
$this->conf = $invokingObj->conf;
if ($this->conf['code'] == 'PLAINTEXT') {
$this->cObj = $invokingObj->cObj;
$this->config = $invokingObj->config;
$this->tt_news_uid = $invokingObj->tt_news_uid;
$this->enableFields = $invokingObj->enableFields;
$this->sys_language_mode = $invokingObj->sys_language_mode;
$this->templateCode = $invokingObj->templateCode;
$this->renderPlainText = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_directmail_pi1');
$this->renderPlainText->init($GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_directmail_pi1.']);
$this->renderPlainText->cObj = $this->cObj;
$this->renderPlainText->labelsList = 'tt_news_author_prefix,tt_news_author_date_prefix,tt_news_author_email_prefix,tt_news_short_header,tt_news_bodytext_header';
$lines = array();
$singleWhere = 'tt_news.uid=' . intval($this->tt_news_uid);
$singleWhere .= ' AND type=0' . $this->enableFields;
// type=0->only real news.
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_news', $singleWhere);
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
$GLOBALS['TYPO3_DB']->sql_free_result($res);
// get the translated record if the content language is not the default language
if ($GLOBALS['TSFE']->sys_language_content) {
$OLmode = $this->sys_language_mode == 'strict' ? 'hideNonTranslated' : '';
$row = $GLOBALS['TSFE']->sys_page->getRecordOverlay('tt_news', $row, $GLOBALS['TSFE']->sys_language_content, $OLmode);
}
if (is_array($row)) {
// Render the title
$lines[] = $this->renderPlainText->renderHeader($row['title']);
// Render author of the tt_news record
$lines[] = $this->renderAuthor($row);
// Render the short version of the tt_news record
$lines[] = $this->renderPlainText->breakContent(strip_tags($this->renderPlainText->parseBody($row['short'], 'tt_news_short')));
// Render the main text of the tt_news record
$lines[] = $this->renderPlainText->breakContent(strip_tags($this->renderPlainText->parseBody($row['bodytext'], 'tt_news_bodytext')));
// Render the images of the tt_news record.
$lines[] = $this->getImages($row);
// Render the downloads of the tt_news record.
$lines[] = $this->renderPlainText->renderUploads($row['news_files']);
} elseif ($this->sys_language_mode == 'strict' && $this->tt_news_uid) {
$noTranslMsg = $this->cObj->stdWrap($invokingObj->pi_getLL('noTranslMsg', 'Sorry, there is no translation for this news-article'), $this->conf['noNewsIdMsg_stdWrap.']);
$content .= $noTranslMsg;
}
if (!empty($lines)) {
$content = implode(LF, $lines) . $content;
}
// Substitute labels
if (!empty($content)) {
$markerArray = array();
$markerArray = $this->renderPlainText->addLabelsMarkers($markerArray);
$content = $this->cObj->substituteMarkerArray($content, $markerArray);
}
}
return $content;
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: 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;
}
示例10: pi_list_browseresults
//.........这里部分代码省略.........
$wrapper['showResultsWrap'] = '<p>|</p>';
$wrapper['browseBoxWrap'] = '
<!--
List browsing box:
-->
<div ' . $this->pi_classParam('browsebox') . '>
|
</div>';
// Now overwrite all entries in $wrapper which are also in $wrapArr
$wrapper = array_merge($wrapper, $wrapArr);
// Show pagebrowser
if ($showResultCount != 2) {
if ($pagefloat > -1) {
$lastPage = min($totalPages, max($pointer + 1 + $pagefloat, $maxPages));
$firstPage = max(0, $lastPage - $maxPages);
} else {
$firstPage = 0;
$lastPage = MathUtility::forceIntegerInRange($totalPages, 1, $maxPages);
}
$links = array();
// Make browse-table/links:
// Link to first page
if ($showFirstLast) {
if ($pointer > 0) {
$links[] = $this->cObj->wrap($this->pi_linkTP_keepPIvars($this->pi_getLL('pi_list_browseresults_first', '<< First', $hscText), array($pointerName => NULL), $pi_isOnlyFields), $wrapper['inactiveLinkWrap']);
} else {
$links[] = $this->cObj->wrap($this->pi_getLL('pi_list_browseresults_first', '<< First', $hscText), $wrapper['disabledLinkWrap']);
}
}
// Link to previous page
if ($alwaysPrev >= 0) {
if ($pointer > 0) {
$links[] = $this->cObj->wrap($this->pi_linkTP_keepPIvars($this->pi_getLL('pi_list_browseresults_prev', '< Previous', $hscText), array($pointerName => $pointer - 1 ?: ''), $pi_isOnlyFields), $wrapper['inactiveLinkWrap']);
} elseif ($alwaysPrev) {
$links[] = $this->cObj->wrap($this->pi_getLL('pi_list_browseresults_prev', '< Previous', $hscText), $wrapper['disabledLinkWrap']);
}
}
// Links to pages
for ($a = $firstPage; $a < $lastPage; $a++) {
if ($this->internal['showRange']) {
$pageText = $a * $results_at_a_time + 1 . '-' . min($count, ($a + 1) * $results_at_a_time);
} else {
$pageText = trim($this->pi_getLL('pi_list_browseresults_page', 'Page', $hscText) . ' ' . ($a + 1));
}
// Current page
if ($pointer == $a) {
if ($this->internal['dontLinkActivePage']) {
$links[] = $this->cObj->wrap($pageText, $wrapper['activeLinkWrap']);
} else {
$links[] = $this->cObj->wrap($this->pi_linkTP_keepPIvars($pageText, array($pointerName => $a ?: ''), $pi_isOnlyFields), $wrapper['activeLinkWrap']);
}
} else {
$links[] = $this->cObj->wrap($this->pi_linkTP_keepPIvars($pageText, array($pointerName => $a ?: ''), $pi_isOnlyFields), $wrapper['inactiveLinkWrap']);
}
}
if ($pointer < $totalPages - 1 || $showFirstLast) {
// Link to next page
if ($pointer >= $totalPages - 1) {
$links[] = $this->cObj->wrap($this->pi_getLL('pi_list_browseresults_next', 'Next >', $hscText), $wrapper['disabledLinkWrap']);
} else {
$links[] = $this->cObj->wrap($this->pi_linkTP_keepPIvars($this->pi_getLL('pi_list_browseresults_next', 'Next >', $hscText), array($pointerName => $pointer + 1), $pi_isOnlyFields), $wrapper['inactiveLinkWrap']);
}
}
// Link to last page
if ($showFirstLast) {
if ($pointer < $totalPages - 1) {
$links[] = $this->cObj->wrap($this->pi_linkTP_keepPIvars($this->pi_getLL('pi_list_browseresults_last', 'Last >>', $hscText), array($pointerName => $totalPages - 1), $pi_isOnlyFields), $wrapper['inactiveLinkWrap']);
} else {
$links[] = $this->cObj->wrap($this->pi_getLL('pi_list_browseresults_last', 'Last >>', $hscText), $wrapper['disabledLinkWrap']);
}
}
$theLinks = $this->cObj->wrap(implode(LF, $links), $wrapper['browseLinksWrap']);
} else {
$theLinks = '';
}
$pR1 = $pointer * $results_at_a_time + 1;
$pR2 = $pointer * $results_at_a_time + $results_at_a_time;
if ($showResultCount) {
if ($wrapper['showResultsNumbersWrap']) {
// This will render the resultcount in a more flexible way using markers (new in TYPO3 3.8.0).
// The formatting string is expected to hold template markers (see function header). Example: 'Displaying results ###FROM### to ###TO### out of ###OUT_OF###'
$markerArray['###FROM###'] = $this->cObj->wrap($this->internal['res_count'] > 0 ? $pR1 : 0, $wrapper['showResultsNumbersWrap']);
$markerArray['###TO###'] = $this->cObj->wrap(min($this->internal['res_count'], $pR2), $wrapper['showResultsNumbersWrap']);
$markerArray['###OUT_OF###'] = $this->cObj->wrap($this->internal['res_count'], $wrapper['showResultsNumbersWrap']);
$markerArray['###FROM_TO###'] = $this->cObj->wrap(($this->internal['res_count'] > 0 ? $pR1 : 0) . ' ' . $this->pi_getLL('pi_list_browseresults_to', 'to') . ' ' . min($this->internal['res_count'], $pR2), $wrapper['showResultsNumbersWrap']);
$markerArray['###CURRENT_PAGE###'] = $this->cObj->wrap($pointer + 1, $wrapper['showResultsNumbersWrap']);
$markerArray['###TOTAL_PAGES###'] = $this->cObj->wrap($totalPages, $wrapper['showResultsNumbersWrap']);
// Substitute markers
$resultCountMsg = $this->cObj->substituteMarkerArray($this->pi_getLL('pi_list_browseresults_displays', 'Displaying results ###FROM### to ###TO### out of ###OUT_OF###'), $markerArray);
} else {
// Render the resultcount in the "traditional" way using sprintf
$resultCountMsg = sprintf(str_replace('###SPAN_BEGIN###', '<span' . $this->pi_classParam('browsebox-strong') . '>', $this->pi_getLL('pi_list_browseresults_displays', 'Displaying results ###SPAN_BEGIN###%s to %s</span> out of ###SPAN_BEGIN###%s</span>')), $count > 0 ? $pR1 : 0, min($count, $pR2), $count);
}
$resultCountMsg = $this->cObj->wrap($resultCountMsg, $wrapper['showResultsWrap']);
} else {
$resultCountMsg = '';
}
$sTables = $this->cObj->wrap($resultCountMsg . $theLinks, $wrapper['browseBoxWrap']);
return $sTables;
}
示例11: getMessageForNotification
/**
* @param array $notification
* @return string
*/
protected function getMessageForNotification($notification)
{
return $this->cObj->substituteMarkerArray($this->template, $this->getMarkersForNotification($notification));
}
示例12: 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;
}
示例13: array
/**
* Sends an email to a specific user.
* @param string $content The plugin content
* @param array $conf The plugin's configuration vars
* @return string The content
*
* @deprecated Currently not used
*/
function send_mail($content, $conf)
{
GeneralUtility::logDeprecatedFunction();
$benutzer = $GLOBALS['TSFE']->fe_user->user['username'];
$mailtimeout = 30;
// Mail time Out
if (!empty($benutzer)) {
if ($this->piVars['send'] != 'ok') {
$template = $this->cObj->fileResource($conf['template.']['send_email']);
$template = $this->cObj->getSubpart($template, "###SENDMAIL###");
$marker = array();
// Generate authencification code and insert into database
$mailcode = md5(getenv("REMOTE_ADDR") . $GLOBALS['EXEC_TIME'] . $this->tools->generateRandomString(10));
$insertArray = array('code' => $mailcode, 'tstamp' => $GLOBALS['EXEC_TIME'], 'crdate' => $GLOBALS['EXEC_TIME'], 'cruser_id' => $GLOBALS['TSFE']->fe_user->user['uid']);
$this->databaseHandle->exec_INSERTquery('tx_mmforum_mailkey', $insertArray);
$marker['###MAILCODE###'] = $mailcode;
// Retrieve user name from database
$res = $this->databaseHandle->exec_SELECTquery($this->getUserNameField(), 'fe_users', "uid = '" . intval($this->piVars['uid']) . "'");
list($usermailname) = $this->databaseHandle->sql_fetch_row($res);
$marker['###USERMAILNAME###'] = $usermailname;
} else {
// Check if user is authorized to send emails.
$res = $this->databaseHandle->exec_SELECTquery('*', 'tx_mmforum_mailkey', "code = '" . $this->piVars['authcode'] . "' AND cruser_id = '" . $GLOBALS['TSFE']->fe_user->user['uid'] . "'");
$mailok = $this->databaseHandle->sql_num_rows($res);
if ($mailok) {
// Load template
$template = $this->cObj->fileResource($conf['template.']['send_email']);
$template = $this->cObj->getSubpart($template, "###MAILSTATUS###");
$marker = array();
// Get recipient user data
$res = $this->databaseHandle->exec_SELECTquery($this->getUserNameField() . ',email', 'fe_users', "uid = '" . intval($this->piVars['uid']) . "'");
list($usermailname, $to) = $this->databaseHandle->sql_fetch_row($res);
$header = "From: <" . $GLOBALS['TSFE']->fe_user->user[$this->getUserNameField()] . ">" . $GLOBALS['TSFE']->fe_user->user['email'] . "\n";
$header .= "Reply-To:" . $GLOBALS['TSFE']->fe_user->user['email'] . "\n";
$header .= "Content-type: text/plain;charset=" . $GLOBALS['TSFE']->renderCharset . "\n";
$mailtext = $this->piVars['text'];
$mailtext = nl2br($mailtext);
// Compose and send mail
mail($to, $this->piVars['subject'], $mailtext, $header);
// If "tome" is active, the sender gets a copy of the mail.
if ($this->piVars['uid']) {
mail($GLOBALS['TSFE']->fe_user->user['email'], $this->piVars['subject'], $mailtext, $header);
}
// Remove authentification code from databse
$this->databaseHandle->exec_DELETEquery('tx_mmforum_mailkey', "cruser_id = '" . $GLOBALS['TSFE']->fe_user->user['uid'] . "'");
// Output information
$llMarker = array("###RECIPIENT###" => $usermailname);
$marker['###MAIL_MESSAGE###'] = $this->cObj->substituteMarkerArray($this->pi_getLL('mail.success'), $llMarker);
} else {
// Load template
$template = $this->cObj->fileResource($conf["templateFile"]);
$template = $this->cObj->getSubpart($template, "###LOGINERROR###");
$marker = array();
// Error message
$llMarker = array("###TIMEOUT###" => $mailtimeout);
$marker['###LOGINERROR_MESSAGE###'] = $this->cObj->substituteMarkerArray($this->pi_getLL('mail.timeout'), $llMarker);
}
}
} else {
$template = $this->cObj->fileResource($conf['template.']['login_error']);
$template = $this->cObj->getSubpart($template, "###LOGINERROR###");
$marker = array();
$marker['###LOGINERROR_MESSAGE###'] = $this->pi_getLL('mail.noLogin');
}
$content .= $this->cObj->substituteMarkerArrayCached($template, $marker);
return $content;
}
示例14: main
/**
* Main function, called from TypoScript
* A content object that renders "tt_content" records. See the comment to this class for TypoScript example of how to trigger it.
* This detects the CType of the current content element and renders it accordingly. Only wellknown types are rendered.
*
* @param string $content Empty, ignore.
* @param array $conf TypoScript properties for this content object/function call
*
* @return string
*/
public function main($content, array $conf)
{
global $TYPO3_CONF_VARS;
$this->init($conf);
$lines = array();
$cType = (string) $this->cObj->data['CType'];
switch ($cType) {
case 'header':
$lines[] = $this->getHeader();
if ($this->cObj->data['subheader']) {
$lines[] = $this->breakContent(strip_tags($this->cObj->data['subheader']));
}
break;
case 'text':
// same as textpic
// same as textpic
case 'textpic':
$lines[] = $this->getHeader();
if ($cType == 'textpic' && !($this->cObj->data['imageorient'] & 24)) {
$lines[] = $this->getImages();
$lines[] = '';
}
$lines[] = $this->breakContent(strip_tags($this->parseBody($this->cObj->data['bodytext'])));
if ($cType == 'textpic' && $this->cObj->data['imageorient'] & 24) {
$lines[] = '';
$lines[] = $this->getImages();
}
break;
case 'image':
$lines[] = $this->getHeader();
$lines[] = $this->getImages();
break;
case 'uploads':
$lines[] = $this->getHeader();
$lines[] = $this->renderUploads($this->cObj->data['media']);
break;
case 'menu':
$lines[] = $this->getHeader();
$lines[] = $this->getMenuSitemap();
break;
case 'shortcut':
$lines[] = $this->getShortcut();
break;
case 'bullets':
$lines[] = $this->getHeader();
$lines[] = $this->breakBulletlist(strip_tags($this->parseBody($this->cObj->data['bodytext'])));
break;
case 'table':
$lines[] = $this->getHeader();
$lines[] = $this->breakTable(strip_tags($this->parseBody($this->cObj->data['bodytext'])));
break;
case 'html':
$lines[] = $this->getHtml();
break;
default:
// Hook for processing other content types
if (is_array($TYPO3_CONF_VARS['EXTCONF']['direct_mail']['renderCType'])) {
foreach ($TYPO3_CONF_VARS['EXTCONF']['direct_mail']['renderCType'] as $classRef) {
$procObj =& GeneralUtility::getUserObj($classRef);
$lines = array_merge($lines, $procObj->renderPlainText($this, $content));
}
}
if (empty($lines)) {
$defaultOutput = $this->getString($this->conf['defaultOutput']);
if ($defaultOutput) {
$lines[] = str_replace('###CType###', $cType, $defaultOutput);
}
}
}
// First break.
$lines[] = '';
$content = implode(LF, $lines);
// Substitute labels
$markerArray = array();
$markerArray = $this->addLabelsMarkers($markerArray);
$content = $this->cObj->substituteMarkerArray($content, $markerArray);
// User processing:
$content = $this->userProcess('userProc', $content);
return $content;
}