本文整理汇总了PHP中TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::stdWrap方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentObjectRenderer::stdWrap方法的具体用法?PHP ContentObjectRenderer::stdWrap怎么用?PHP ContentObjectRenderer::stdWrap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
的用法示例。
在下文中一共展示了ContentObjectRenderer::stdWrap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor.
*
* @param Tx_Solr_Query $query Solr query
*/
public function __construct(Tx_Solr_Query $query)
{
$this->solrConfiguration = Tx_Solr_Util::getSolrConfiguration();
$this->contentObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
$this->query = $query;
$targetPageUid = $this->contentObject->stdWrap($this->solrConfiguration['search.']['targetPage'], $this->solrConfiguration['search.']['targetPage.']);
$this->linkTargetPageId = $targetPageUid;
if (empty($this->linkTargetPageId)) {
$this->linkTargetPageId = $GLOBALS['TSFE']->id;
}
}
示例2: execute
/**
* Converts a given unix timestamp to a human readable date
*
* @param array $arguments
* @return string
*/
public function execute(array $arguments = array())
{
$content = '';
if (count($arguments) > 1) {
$this->dateFormat['date'] = $arguments[1];
}
if (is_numeric($arguments[0])) {
$content = $this->contentObject->stdWrap($arguments[0], $this->dateFormat);
}
return $content;
}
示例3: execute
/**
* Converts a given unix timestamp to a human readable date
*
* @param array $arguments
* @return string
*/
public function execute(array $arguments = array())
{
$content = '';
if (count($arguments) > 1) {
$this->dateFormat = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['general.']['dateFormat.'];
$this->dateFormat['date'] = $arguments[1];
}
if (is_numeric($arguments[0])) {
$content = $this->contentObject->stdWrap($arguments[0], $this->dateFormat);
}
return $content;
}
示例4: applyStdWrapRecursive
/**
* Recursively looks for stdWrap and executes it
*
* @param array $conf Current section of configuration to work on
* @param int $level Current level being processed (currently just for tracking; no limit enforced)
* @return array Current section of configuration after stdWrap applied
*/
protected function applyStdWrapRecursive(array $conf, $level = 0)
{
foreach ($conf as $key => $confNextLevel) {
if (strpos($key, '.') !== FALSE) {
$key = substr($key, 0, -1);
// descend into all non-stdWrap-subelements first
foreach ($confNextLevel as $subKey => $subConfNextLevel) {
if (is_array($subConfNextLevel) && strpos($subKey, '.') !== FALSE && $subKey !== 'stdWrap.') {
$conf[$key . '.'] = $this->applyStdWrapRecursive($confNextLevel, $level + 1);
}
}
// now for stdWrap
foreach ($confNextLevel as $subKey => $subConfNextLevel) {
if (is_array($subConfNextLevel) && $subKey === 'stdWrap.') {
$conf[$key] = $this->cObj->stdWrap($conf[$key], $conf[$key . '.']['stdWrap.']);
unset($conf[$key . '.']['stdWrap.']);
if (empty($conf[$key . '.'])) {
unset($conf[$key . '.']);
}
}
}
}
}
return $conf;
}
示例5: cObjGetSingleExt
/**
* Renders the application defined cObject FORM
* which overrides the TYPO3 default cObject FORM
*
* Convert FORM to COA_INT - COA_INT.10 = FORM_INT
* If FORM_INT is also dedected by the ContentObjectRenderer, and now
* the Extbaseplugin "Form" is initalized. At this time the
* controller "Frontend" action "execute" do the rest.
*
* @param string $typoScriptObjectName Name of the object
* @param array $typoScript TS configuration for this cObject
* @param string $typoScriptKey A string label used for the internal debugging tracking.
* @param ContentObjectRenderer $contentObject reference
* @return string HTML output
*/
public function cObjGetSingleExt($typoScriptObjectName, array $typoScript, $typoScriptKey, ContentObjectRenderer $contentObject)
{
$content = '';
if ($typoScriptObjectName === 'FORM' && !empty($typoScript['useDefaultContentObject']) && ExtensionManagementUtility::isLoaded('compatibility6')) {
$content = $contentObject->getContentObject($typoScriptObjectName)->render($typoScript);
} elseif ($typoScriptObjectName === 'FORM') {
$mergedTypoScript = null;
if ($contentObject->data['CType'] === 'mailform') {
$bodytext = $contentObject->data['bodytext'];
/** @var $typoScriptParser TypoScriptParser */
$typoScriptParser = GeneralUtility::makeInstance(TypoScriptParser::class);
$typoScriptParser->parse($bodytext);
$mergedTypoScript = (array) $typoScriptParser->setup;
ArrayUtility::mergeRecursiveWithOverrule($mergedTypoScript, $typoScript);
// Disables content elements since TypoScript is handled that could contain insecure settings:
$mergedTypoScript[Configuration::DISABLE_CONTENT_ELEMENT_RENDERING] = true;
}
$newTypoScript = array('10' => 'FORM_INT', '10.' => is_array($mergedTypoScript) ? $mergedTypoScript : $typoScript);
$content = $contentObject->cObjGetSingle('COA_INT', $newTypoScript);
// Only apply stdWrap to TypoScript that was NOT created by the wizard:
if (isset($typoScript['stdWrap.'])) {
$content = $contentObject->stdWrap($content, $typoScript['stdWrap.']);
}
} elseif ($typoScriptObjectName === 'FORM_INT') {
$extbase = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Core\Bootstrap::class);
$content = $extbase->run('', array('pluginName' => 'Form', 'extensionName' => 'Form', 'vendorName' => 'TYPO3\\CMS', 'controller' => 'Frontend', 'action' => 'show', 'settings' => array('typoscript' => $typoScript), 'persistence' => array(), 'view' => array()));
}
return $content;
}
示例6: mergeTypoScript
/**
* Merge all TypoScript for the typoLink from the global and local defined settings.
*
* @param array $linkConfigurationArray Global defined TypoScript cofiguration for the linkHandler
* @param array $typoLinkConfigurationArray Local typolink TypoScript configuration for current link
* @param string $recordTableName The name of database table
* @access protected
* @return array
*/
protected function mergeTypoScript(array $linkConfigurationArray, array $typoLinkConfigurationArray, $recordTableName)
{
// pre-compile the "additionalParams"
$linkConfigurationArray[$recordTableName . '.']['additionalParams'] = $this->localContentObject->stdWrap($linkConfigurationArray[$recordTableName . '.']['additionalParams'], $linkConfigurationArray[$recordTableName . '.']['additionalParams.']);
unset($linkConfigurationArray[$recordTableName . '.']['additionalParams.']);
if (version_compare(TYPO3_version, '6.2.0', '<')) {
$mergeLinkConfigurationArray = \TYPO3\CMS\Core\Utility\GeneralUtility::explodeUrl2Array($linkConfigurationArray[$recordTableName . '.']['additionalParams']);
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($mergeLinkConfigurationArray, \TYPO3\CMS\Core\Utility\GeneralUtility::explodeUrl2Array($typoLinkConfigurationArray['additionalParams']));
} else {
$mergeLinkConfigurationArray = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule(\TYPO3\CMS\Core\Utility\GeneralUtility::explodeUrl2Array($linkConfigurationArray[$recordTableName . '.']['additionalParams']), \TYPO3\CMS\Core\Utility\GeneralUtility::explodeUrl2Array($typoLinkConfigurationArray['additionalParams']));
}
// merge recursive the "additionalParams" from "$typoScriptConfiguration" with the "$typoLinkConfigurationArray"
if (array_key_exists('additionalParams', $typoLinkConfigurationArray)) {
$typoLinkConfigurationArray['additionalParams'] = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $mergeLinkConfigurationArray);
}
/**
* @internal Merge the linkhandler configuration from $typoScriptConfiguration with the current $typoLinkConfiguration.
*/
if (is_array($typoLinkConfigurationArray) && !empty($typoLinkConfigurationArray)) {
if (array_key_exists('parameter.', $typoLinkConfigurationArray)) {
unset($typoLinkConfigurationArray['parameter.']);
}
$linkConfigurationArray[$recordTableName . '.'] = array_merge($linkConfigurationArray[$recordTableName . '.'], $typoLinkConfigurationArray);
}
return $linkConfigurationArray[$recordTableName . '.'];
}
示例7: editIcons
/**
* Adds an edit icon to the content string. The edit icon links to EditDocumentController with proper parameters for editing the table/fields of the context.
* This implements TYPO3 context sensitive editing facilities. Only backend users will have access (if properly configured as well).
*
* @param string $content The content to which the edit icons should be appended
* @param string $params The parameters defining which table and fields to edit. Syntax is [tablename]:[fieldname],[fieldname],[fieldname],... OR [fieldname],[fieldname],[fieldname],... (basically "[tablename]:" is optional, default table is the one of the "current record" used in the function). The fieldlist is sent as "&columnsOnly=" parameter to EditDocumentController
* @param array $conf TypoScript properties for configuring the edit icons.
* @param string $currentRecord The "table:uid" of the record being shown. If empty string then $this->currentRecord is used. For new records (set by $conf['newRecordFromTable']) it's auto-generated to "[tablename]:NEW
* @param array $dataArr Alternative data array to use. Default is $this->data
* @param string $addUrlParamStr Additional URL parameters for the link pointing to EditDocumentController
* @param string $table
* @param int $editUid
* @param string $fieldList
* @return string The input content string, possibly with edit icons added (not necessarily in the end but just after the last string of normal content.
*/
public function editIcons($content, $params, array $conf = array(), $currentRecord = '', array $dataArr = array(), $addUrlParamStr = '', $table, $editUid, $fieldList)
{
// Special content is about to be shown, so the cache must be disabled.
$this->frontendController->set_no_cache('Display frontend edit icons', TRUE);
$iconTitle = $this->cObj->stdWrap($conf['iconTitle'], $conf['iconTitle.']);
$optionsArray = array('title' => htmlspecialchars($iconTitle, ENT_COMPAT, 'UTF-8', FALSE), 'class' => 'frontEndEditIcons', 'style' => $conf['styleAttribute'] ? htmlspecialchars($conf['styleAttribute']) : '');
$iconImg = $conf['iconImg'] ? $conf['iconImg'] : IconUtility::getSpriteIcon('actions-document-open', $optionsArray);
$nV = GeneralUtility::_GP('ADMCMD_view') ? 1 : 0;
$url = BackendUtility::getModuleUrl('record_edit', array('edit[' . $table . '][' . $editUid . ']' => 'edit', 'columnsOnly' => $fieldList, 'noView' => $nV)) . $addUrlParamStr;
$icon = $this->editPanelLinkWrap_doWrap($iconImg, $url);
if ($conf['beforeLastTag'] < 0) {
$content = $icon . $content;
} elseif ($conf['beforeLastTag'] > 0) {
$cBuf = rtrim($content);
$secureCount = 30;
while ($secureCount && substr($cBuf, -1) == '>' && substr($cBuf, -4) != '</a>') {
$cBuf = rtrim(preg_replace('/<[^<]*>$/', '', $cBuf));
$secureCount--;
}
$content = strlen($cBuf) && $secureCount ? substr($content, 0, strlen($cBuf)) . $icon . substr($content, strlen($cBuf)) : ($content = $icon . $content);
} else {
$content .= $icon;
}
return $content;
}
示例8: recursiveStdWrapIsOnlyCalledOnce
/**
* @test
*/
public function recursiveStdWrapIsOnlyCalledOnce() {
$stdWrapConfiguration = array(
'append' => 'TEXT',
'append.' => array(
'data' => 'register:Counter'
),
'stdWrap.' => array(
'append' => 'LOAD_REGISTER',
'append.' => array(
'Counter.' => array(
'prioriCalc' => 'intval',
'cObject' => 'TEXT',
'cObject.' => array(
'data' => 'register:Counter',
'wrap' => '|+1',
)
)
)
)
);
$this->assertSame(
'Counter:1',
$this->subject->stdWrap('Counter:', $stdWrapConfiguration)
);
}
示例9: editIcons
/**
* Adds an edit icon to the content string. The edit icon links to alt_doc.php with proper parameters for editing the table/fields of the context.
* This implements TYPO3 context sensitive editing facilities. Only backend users will have access (if properly configured as well).
*
* @param string $content The content to which the edit icons should be appended
* @param string $params The parameters defining which table and fields to edit. Syntax is [tablename]:[fieldname],[fieldname],[fieldname],... OR [fieldname],[fieldname],[fieldname],... (basically "[tablename]:" is optional, default table is the one of the "current record" used in the function). The fieldlist is sent as "&columnsOnly=" parameter to alt_doc.php
* @param array $conf TypoScript properties for configuring the edit icons.
* @param string $currentRecord The "table:uid" of the record being shown. If empty string then $this->currentRecord is used. For new records (set by $conf['newRecordFromTable']) it's auto-generated to "[tablename]:NEW
* @param array $dataArr Alternative data array to use. Default is $this->data
* @param string $addUrlParamStr Additional URL parameters for the link pointing to alt_doc.php
* @param string $table
* @param integer $editUid
* @param string $fieldList
* @return string The input content string, possibly with edit icons added (not necessarily in the end but just after the last string of normal content.
*/
public function editIcons($content, $params, array $conf = array(), $currentRecord = '', array $dataArr = array(), $addUrlParamStr = '', $table, $editUid, $fieldList)
{
// Special content is about to be shown, so the cache must be disabled.
$GLOBALS['TSFE']->set_no_cache();
$style = $conf['styleAttribute'] ? ' style="' . htmlspecialchars($conf['styleAttribute']) . '"' : '';
$iconTitle = $this->cObj->stdWrap($conf['iconTitle'], $conf['iconTitle.']);
$iconImg = $conf['iconImg'] ? $conf['iconImg'] : '<img ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg(TYPO3_mainDir, 'gfx/edit_fe.gif', 'width="11" height="12" border="0" align="top" ') . ' title="' . \TYPO3\CMS\Core\Utility\GeneralUtility::deHSCentities(htmlspecialchars($iconTitle)) . '"' . $style . ' class="frontEndEditIcons" alt="" />';
$nV = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('ADMCMD_view') ? 1 : 0;
$adminURL = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir;
$icon = $this->editPanelLinkWrap_doWrap($iconImg, $adminURL . 'alt_doc.php?edit[' . $table . '][' . $editUid . ']=edit&columnsOnly=' . rawurlencode($fieldList) . '&noView=' . $nV . $addUrlParamStr, $currentRecord);
if ($conf['beforeLastTag'] < 0) {
$content = $icon . $content;
} elseif ($conf['beforeLastTag'] > 0) {
$cBuf = rtrim($content);
$securCount = 30;
while ($securCount && substr($cBuf, -1) == '>' && substr($cBuf, -4) != '</a>') {
$cBuf = rtrim(preg_replace('/<[^<]*>$/', '', $cBuf));
$securCount--;
}
$content = strlen($cBuf) && $securCount ? substr($content, 0, strlen($cBuf)) . $icon . substr($content, strlen($cBuf)) : ($content = $icon . $content);
} else {
$content .= $icon;
}
return $content;
}
示例10: __construct
/**
* Constructor.
*
* @param Query $query Solr query
*/
public function __construct(Query $query)
{
$this->solrConfiguration = Util::getSolrConfiguration();
$this->contentObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
$this->query = $query;
$targetPageUid = $this->contentObject->stdWrap($this->solrConfiguration->getSearchTargetPage(), $this->solrConfiguration->getSearchTargetPageConfiguration());
$this->linkTargetPageId = $targetPageUid;
}
示例11: getBannedUids
/**
* Returns an array of banned UIDs (from excludeUidList)
*
* @return array Array of banned UIDs
* @internal
*/
public function getBannedUids()
{
$excludeUidList = isset($this->conf['excludeUidList.']) ? $this->parent_cObj->stdWrap($this->conf['excludeUidList'], $this->conf['excludeUidList.']) : $this->conf['excludeUidList'];
if (!trim($excludeUidList)) {
return [];
}
$banUidList = str_replace('current', $this->getTypoScriptFrontendController()->page['uid'], $excludeUidList);
return GeneralUtility::intExplode(',', $banUidList);
}
示例12: getBannedUids
/**
* Returns an array of banned UIDs (from excludeUidList)
*
* @return array Array of banned UIDs
* @access private
* @todo Define visibility
*/
public function getBannedUids()
{
$excludeUidList = isset($this->conf['excludeUidList.']) ? $this->parent_cObj->stdWrap($this->conf['excludeUidList'], $this->conf['excludeUidList.']) : $this->conf['excludeUidList'];
if (!trim($excludeUidList)) {
return array();
}
$banUidList = str_replace('current', $GLOBALS['TSFE']->page['uid'], $excludeUidList);
return GeneralUtility::intExplode(',', $banUidList);
}
示例13: renderHeader
/**
* Renders a content element header, observing the layout type giving different header formattings
*
* @param string $str The header string
* @param integer $type The layout type of the header (in the content element)
*
* @return string Content
*/
public function renderHeader($str, $type = 0)
{
if ($str) {
$hConf = $this->conf['header.'];
$defaultType = DirectMailUtility::intInRangeWrapper($hConf['defaultType'], 1, 5);
$type = DirectMailUtility::intInRangeWrapper($type, 0, 6);
if (!$type) {
$type = $defaultType;
}
if ($type != 6) {
// not hidden
$tConf = $hConf[$type . '.'];
if ($tConf['removeSplitChar']) {
$str = preg_replace('/' . preg_quote($tConf['removeSplitChar'], '/') . '/', '', $str);
}
$lines = array();
$blanks = DirectMailUtility::intInRangeWrapper($tConf['preBlanks'], 0, 1000);
if ($blanks) {
$lines[] = str_pad('', $blanks - 1, LF);
}
$lines = $this->pad($lines, $tConf['preLineChar'], $tConf['preLineLen']);
$blanks = DirectMailUtility::intInRangeWrapper($tConf['preLineBlanks'], 0, 1000);
if ($blanks) {
$lines[] = str_pad('', $blanks - 1, LF);
}
if ($this->cObj->data['date']) {
$lines[] = $this->getString($hConf['datePrefix']) . date($hConf['date'] ? $hConf['date'] : 'd-m-Y', $this->cObj->data['date']);
}
$prefix = '';
$str = $this->getString($tConf['prefix']) . $str;
if ($tConf['autonumber']) {
$str = $this->cObj->parentRecordNumber . $str;
}
if ($this->cObj->data['header_position'] == 'right') {
$prefix = str_pad(' ', $this->charWidth - strlen($str));
}
if ($this->cObj->data['header_position'] == 'center') {
$prefix = str_pad(' ', floor(($this->charWidth - strlen($str)) / 2));
}
$lines[] = $this->cObj->stdWrap($prefix . $str, $tConf['stdWrap.']);
if ($this->cObj->data['header_link']) {
$lines[] = $this->getString($hConf['linkPrefix']) . $this->getLink($this->cObj->data['header_link']);
}
$blanks = DirectMailUtility::intInRangeWrapper($tConf['postLineBlanks'], 0, 1000);
if ($blanks) {
$lines[] = str_pad('', $blanks - 1, LF);
}
$lines = $this->pad($lines, $tConf['postLineChar'], $tConf['postLineLen']);
$blanks = DirectMailUtility::intInRangeWrapper($tConf['postBlanks'], 0, 1000);
if ($blanks) {
$lines[] = str_pad('', $blanks - 1, LF);
}
return implode(LF, $lines);
}
}
return "";
}
示例14: getReCaptcha
/**
* Build reCAPTCHA Frontend HTML-Code
*
* @return string reCAPTCHA HTML-Code
*/
public function getReCaptcha()
{
if (!$this->developMode || $this->enforceCaptcha) {
$captcha = $this->contentObject->stdWrap($this->configuration['public_key'], $this->configuration['public_key.']);
} else {
$captcha = '<div class="recaptcha-development-mode">
Development mode active. Do not expect the captcha to appear
</div>';
}
return $captcha;
}
示例15: render_clickenlarge
/**
* Rendering the "data-htmlarea-clickenlarge" custom attribute, called from TypoScript
*
* @param string Content input. Not used, ignore.
* @param array TypoScript configuration
* @return string HTML output.
* @access private
* @todo Define visibility
*/
public function render_clickenlarge($content, $conf)
{
$clickenlarge = isset($this->cObj->parameters['data-htmlarea-clickenlarge']) ? $this->cObj->parameters['data-htmlarea-clickenlarge'] : 0;
if (!$clickenlarge) {
// Backward compatibility
$clickenlarge = isset($this->cObj->parameters['clickenlarge']) ? $this->cObj->parameters['clickenlarge'] : 0;
}
$fileFactory = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance();
$fileTable = $this->cObj->parameters['data-htmlarea-file-table'];
$fileUid = $this->cObj->parameters['data-htmlarea-file-uid'];
if ($fileUid) {
$fileObject = $fileFactory->getFileObject($fileUid);
$filePath = $fileObject->getForLocalProcessing(FALSE);
$file = \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix($filePath);
} else {
// Pre-FAL backward compatibility
$path = $this->cObj->parameters['src'];
$magicFolder = $fileFactory->getFolderObjectFromCombinedIdentifier($GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir']);
if ($magicFolder instanceof \TYPO3\CMS\Core\Resource\Folder) {
$magicFolderPath = $magicFolder->getPublicUrl();
$pathPre = $magicFolderPath . 'RTEmagicC_';
if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($path, $pathPre)) {
// Find original file:
$pI = pathinfo(substr($path, strlen($pathPre)));
$filename = substr($pI['basename'], 0, -strlen('.' . $pI['extension']));
$file = $magicFolderPath . 'RTEmagicP_' . $filename;
} else {
$file = $this->cObj->parameters['src'];
}
}
}
// Unset clickenlarge custom attribute
unset($this->cObj->parameters['data-htmlarea-clickenlarge']);
// Backward compatibility
unset($this->cObj->parameters['clickenlarge']);
unset($this->cObj->parameters['allParams']);
$content = '<img ' . \TYPO3\CMS\Core\Utility\GeneralUtility::implodeAttributes($this->cObj->parameters, TRUE, TRUE) . ' />';
if ($clickenlarge && is_array($conf['imageLinkWrap.'])) {
$theImage = $file ? $GLOBALS['TSFE']->tmpl->getFileName($file) : '';
if ($theImage) {
$this->cObj->parameters['origFile'] = $theImage;
if ($this->cObj->parameters['title']) {
$conf['imageLinkWrap.']['title'] = $this->cObj->parameters['title'];
}
if ($this->cObj->parameters['alt']) {
$conf['imageLinkWrap.']['alt'] = $this->cObj->parameters['alt'];
}
$content = $this->cObj->imageLinkWrap($content, $theImage, $conf['imageLinkWrap.']);
$content = $this->cObj->stdWrap($content, $conf['stdWrap.']);
}
}
return $content;
}