本文整理汇总了PHP中TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::getTypoLink_URL方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentObjectRenderer::getTypoLink_URL方法的具体用法?PHP ContentObjectRenderer::getTypoLink_URL怎么用?PHP ContentObjectRenderer::getTypoLink_URL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
的用法示例。
在下文中一共展示了ContentObjectRenderer::getTypoLink_URL方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLink
/**
* Returns a typolink URL based on input.
*
* @param string $ll Parameter to typolink
*
* @return string The URL returned from $this->cObj->getTypoLink_URL(); - possibly it prefixed with the URL of the site if not present already
*/
public function getLink($ll)
{
$theLink = $this->cObj->getTypoLink_URL($ll);
if (substr($theLink, 0, 4) != 'http') {
$theLink = $this->siteUrl . $theLink;
}
return $theLink;
}
示例2: execute
/**
* Provides the values for the markers in the simple form template
*
* @return array An array containing values for markers in the simple form template
* @throws \InvalidArgumentException if an registered form modifier fails to implement the required interface ApacheSolrForTypo3\Solr\Plugin\FormModifier
*/
public function execute()
{
$url = $this->cObj->getTypoLink_URL($this->parentPlugin->typoScriptConfiguration->getSearchTargetPage());
$marker = array('action' => htmlspecialchars($url), 'action_id' => intval($this->parentPlugin->typoScriptConfiguration->getSearchTargetPage()), 'action_language' => intval($GLOBALS['TSFE']->sys_page->sys_language_uid), 'action_language_parameter' => 'L', 'accept-charset' => $GLOBALS['TSFE']->metaCharset, 'q' => $this->parentPlugin->getCleanUserQuery());
// hook to modify the search form
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['modifySearchForm'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['modifySearchForm'] as $classReference) {
$formModifier = GeneralUtility::getUserObj($classReference);
if ($formModifier instanceof FormModifier) {
if ($formModifier instanceof CommandPluginAware) {
$formModifier->setParentPlugin($this->parentPlugin);
}
$marker = $formModifier->modifyForm($marker, $this->parentPlugin->getTemplate());
} else {
throw new \InvalidArgumentException('Form modifier "' . $classReference . '" must implement the ApacheSolrForTypo3\\Solr\\Plugin\\FormModifier interface.', 1262864703);
}
}
}
return $marker;
}
示例3: getConfirmationButtons
/**
* Get confirmation buttons
*
* @return string
*/
protected function getConfirmationButtons() {
$requestHandler = GeneralUtility::makeInstance(\TYPO3\CMS\Form\Request::class);
$prefix = $requestHandler->getPrefix();
$action = $this->localCobj->getTypoLink_URL($GLOBALS['TSFE']->id);
$confirmationButtons = '
<form class="csc-form-confirmation" method="post" action="' . $action . '">
<fieldset>
<ol>
<li class="csc-form-confirmation-false">
<input type="submit" value="' . $this->getLocalLanguageLabel('donotconfirm') . '" name="' . $prefix . '[confirmation-false]" />
</li>
<li class="csc-form-confirmation-true">
<input type="submit" value="' . $this->getLocalLanguageLabel('confirm') . '" name="' . $prefix . '[confirmation-true]" />
</li>
</ol>
</fieldset>
</form>
';
return $confirmationButtons;
}
示例4: pi_getPageLink
/**
* Get URL to some page.
* Returns the URL to page $id with $target and an array of additional url-parameters, $urlParameters
* Simple example: $this->pi_getPageLink(123) to get the URL for page-id 123.
*
* The function basically calls $this->cObj->getTypoLink_URL()
*
* @param int $id Page id
* @param string $target Target value to use. Affects the &type-value of the URL, defaults to current.
* @param array|string $urlParameters As an array key/value pairs represent URL parameters to set. Values NOT URL-encoded yet, keys should be URL-encoded if needed. As a string the parameter is expected to be URL-encoded already.
* @return string The resulting URL
* @see pi_linkToPage()
* @see ContentObjectRenderer->getTypoLink()
*/
public function pi_getPageLink($id, $target = '', $urlParameters = array())
{
return $this->cObj->getTypoLink_URL($id, $urlParameters, $target);
}
示例5: getLink
/**
* Returns a typolink URL based on input.
*
* @param string $ll : Parameter to typolink
*
* @return string The URL returned from $this->cObj->getTypoLink_URL(); - possibly it prefixed with the URL of the site if not present already
*/
function getLink($ll)
{
return $this->contentObject->getTypoLink_URL($ll);
}
示例6: renderContent
/**
* render the meta tags
*
* @param $meta
* @return string
*/
protected function renderContent($meta)
{
/** @var \Clickstorm\CsSeo\Utility\TSFEUtility $tsfeUtility */
$tsfeUtility = GeneralUtility::makeInstance(\Clickstorm\CsSeo\Utility\TSFEUtility::class, $GLOBALS['TSFE']->id);
$pluginSettings = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_csseo.'];
$content = '';
$title = $meta['title'];
// title
if ($title) {
$title = $tsfeUtility->getFinalTitle($meta['title'], $meta['title_only']);
} else {
// fallback to page title
$pageTitleFunc = GeneralUtility::makeInstance(PageTitle::class);
$title = $pageTitleFunc->render('', array());
}
$content .= '<title>' . $title . '</title>';
// description
$content .= $this->printMetaTag('description', $meta['description']);
// hreflang & canonical
$typoLinkConf = $GLOBALS['TSFE']->tmpl->setup['lib.']['currentUrl.']['typolink.'];
unset($typoLinkConf['parameter.']);
$typoLinkConf['parameter'] = $GLOBALS['TSFE']->id;
// get active table and uid
$tables = self::getPageTS();
$cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class);
$currentItem = self::getCurrentTable($tables, $cObj);
$allLanguagesFromItem = $this->getAllLanguagesFromItem($currentItem['table'], $currentItem['uid']);
$currentLanguageUid = $GLOBALS['TSFE']->sys_language_uid;
// canonical
if ($meta['canonical']) {
$canonical = $this->cObj->getTypoLink_URL($meta['canonical']);
} else {
$canonicalTypoLinkConf = $typoLinkConf;
// if a fallback is shown, set canonical to the language of the ordered item
if (!in_array($currentLanguageUid, $allLanguagesFromItem)) {
unset($canonicalTypoLinkConf['additionalParams.']);
$canonicalTypoLinkConf['additionalParams'] = '&L=' . $this->getLanguageFromItem($currentItem['table'], $currentItem['uid']);
}
$canonical = $this->cObj->typoLink_URL($canonicalTypoLinkConf);
}
// index
if ($meta['no_index']) {
$content .= $this->printMetaTag('robots', 'noindex,nofollow');
} else {
$content .= '<link rel="canonical" href="' . $canonical . '" />';
}
// hreflang
// if the item for the current language uid exists and
// the item is not set to no index and
// the item points not to another page as canonical and
// the TS setting hreflang.enabled is set to 1
if (in_array($currentLanguageUid, $allLanguagesFromItem) && !$meta['no_index'] && !$meta['canonical'] && $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_csseo.']['hreflang.']['enable']) {
$langIds = explode(",", $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_csseo.']['hreflang.']['ids']);
$langKeys = explode(",", $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_csseo.']['hreflang.']['keys']);
$hreflangTypoLinkConf = $typoLinkConf;
foreach ($langIds as $key => $langId) {
// set hreflang only for languages of the TS setup and if the language is also localized for the item
// if the language doesn't exist for the item and a fallback language is shown, the hreflang is not set and the canonical points to the fallback url
if (in_array($langId, $allLanguagesFromItem)) {
unset($hreflangTypoLinkConf['additionalParams.']);
$hreflangTypoLinkConf['additionalParams'] = '&L=' . $langId;
$hreflangUrl = $this->cObj->typoLink_URL($hreflangTypoLinkConf);
$content .= '<link rel="alternate" hreflang="' . $langKeys[$key] . '" href="' . $hreflangUrl . '" />';
}
}
}
// og:title
$ogTitle = $meta['og_title'] ?: $title;
$content .= $this->printMetaTag('og:title', $ogTitle, 1);
// og:description
$ogDescription = $meta['og_description'] ?: $meta['description'];
$content .= $this->printMetaTag('og:description', $ogDescription, 1);
// og:image
$ogImageURL = $pluginSettings['social.']['defaultImage'];
if ($meta['og_image']) {
$ogImageURL = $this->getImagePath('og_image', $meta['uid']);
}
if ($ogImageURL) {
$finalOgImageURL = $this->getScaledImagePath($ogImageURL, $pluginSettings['social.']['openGraph.']['image.']);
$content .= $this->printMetaTag('og:image', $finalOgImageURL, 1);
}
// og:type
$content .= $this->printMetaTag('og:type', 'website', 1);
// og:url
$content .= $this->printMetaTag('og:url', $canonical, 1);
// og:locale
$content .= $this->printMetaTag('og:locale', $GLOBALS['TSFE']->config['config']['locale_all'], 1);
// og:site_name
$content .= $this->printMetaTag('og:site_name', $GLOBALS['TSFE']->tmpl->sitetitle, 1);
// twitter title
if ($meta['tw_title']) {
$content .= $this->printMetaTag('twitter:title', $meta['tw_title']);
}
// twitter description
//.........这里部分代码省略.........
示例7: displaySingle
/**
* Displays the "single view" of a news article. Is also used when displaying single news records with the "insert records" content element.
*
* @return string html-code for the "single view"
*/
function displaySingle()
{
$lConf = $this->conf['displaySingle.'];
$content = '';
$selectConf = array();
$selectConf['selectFields'] = '*';
$selectConf['fromTable'] = 'tt_news';
$selectConf['where'] = 'tt_news.uid=' . $this->tt_news_uid;
$selectConf['where'] .= $this->enableFields;
// function Hook for processing the selectConf array
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['tt_news']['sViewSelectConfHook'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['tt_news']['sViewSelectConfHook'] as $_classRef) {
$_procObj =& \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
$selectConf = $_procObj->processSViewSelectConfHook($this, $selectConf);
}
}
$res = $this->db->exec_SELECTquery($selectConf['selectFields'], $selectConf['fromTable'], $selectConf['where'], $selectConf['groupBy'], $selectConf['orderBy'], $selectConf['limit']);
$row = $this->db->sql_fetch_assoc($res);
$this->db->sql_free_result($res);
// First get workspace/version overlay and fix workspace pid:
if ($this->versioningEnabled) {
$this->tsfe->sys_page->versionOL('tt_news', $row);
$this->tsfe->sys_page->fixVersioningPid('tt_news', $row);
}
// Then get localization of record:
// (if the content language is not the default language)
if ($this->tsfe->sys_language_content) {
$OLmode = $this->sys_language_mode == 'strict' ? 'hideNonTranslated' : '';
$row = $this->tsfe->sys_page->getRecordOverlay('tt_news', $row, $this->tsfe->sys_language_content, $OLmode);
}
// Register displayed news item globally:
$GLOBALS['T3_VAR']['displayedNews'][] = $row['uid'];
$markerArray = array();
if (is_array($row) && ($row['pid'] > 0 || $this->vPrev)) {
// never display versions of a news record (having pid=-1) for normal website users
$this->upstreamVars['mode'] = 'display';
// If type is 1 or 2 (internal/external link), redirect to accordant page:
if (is_array($row) && \TYPO3\CMS\Core\Utility\GeneralUtility::inList('1,2', $row['type'])) {
$redirectUrl = $this->local_cObj->getTypoLink_URL($row['type'] == 1 ? $row['page'] : $row['ext_url']);
\TYPO3\CMS\Core\Utility\HttpUtility::redirect($redirectUrl);
}
$item = FALSE;
// reset marker array
$wrappedSubpartArray = array();
if (!$this->useUpstreamRenderer) {
// Get the subpart code
if ($this->conf['displayCurrentRecord']) {
$item = trim($this->getNewsSubpart($this->templateCode, $this->spMarker('###TEMPLATE_SINGLE_RECORDINSERT###'), $row));
}
if (!$item) {
$item = $this->getNewsSubpart($this->templateCode, $this->spMarker('###TEMPLATE_' . $this->theCode . '###'), $row);
}
$renderMarkers = $this->getMarkers($item);
$this->renderMarkers = array_unique($renderMarkers);
// build the backToList link
if ($this->conf['useHRDates']) {
$wrappedSubpartArray['###LINK_ITEM###'] = explode('|', $this->pi_linkTP_keepPIvars('|', array('tt_news' => null, 'backPid' => null, $this->config['singleViewPointerName'] => null, 'pS' => null, 'pL' => null), $this->allowCaching, $this->conf['dontUseBackPid'] ? 1 : 0, $this->config['backPid']));
} else {
$wrappedSubpartArray['###LINK_ITEM###'] = explode('|', $this->pi_linkTP_keepPIvars('|', array('tt_news' => null, 'backPid' => null, $this->config['singleViewPointerName'] => null), $this->allowCaching, $this->conf['dontUseBackPid'] ? 1 : 0, $this->config['backPid']));
}
}
// set the title of the single view page to the title of the news record
if ($this->conf['substitutePagetitle']) {
/**
* TODO: 05.05.2009
* pagetitle stdWrap
*/
$this->tsfe->page['title'] = $row['title'];
// set pagetitle for indexed search to news title
$this->tsfe->indexedDocTitle = $row['title'];
}
if ($lConf['catOrderBy']) {
$this->config['catOrderBy'] = $lConf['catOrderBy'];
}
$this->categories = array();
$this->categories[$row['uid']] = $this->getCategories($row['uid']);
$markerArray = $this->getItemMarkerArray($row, $lConf, 'displaySingle');
if (!$this->useUpstreamRenderer) {
// Substitute
$content = $this->cObj->substituteMarkerArrayCached($item, $markerArray, array(), $wrappedSubpartArray);
}
} elseif ($this->sys_language_mode == 'strict' && $this->tt_news_uid && $this->tsfe->sys_language_content) {
// not existing translation
$this->upstreamVars['mode'] = 'noTranslation';
$noTranslMsg = $this->local_cObj->stdWrap($this->pi_getLL('noTranslMsg'), $this->conf['noNewsIdMsg_stdWrap.']);
$content = $noTranslMsg;
} elseif ($row['pid'] < 0) {
// a non-public version of a record was requested
$this->upstreamVars['mode'] = 'nonPlublicVersion';
$nonPlublicVersion = $this->local_cObj->stdWrap($this->pi_getLL('nonPlublicVersionMsg'), $this->conf['nonPlublicVersionMsg_stdWrap.']);
$content = $nonPlublicVersion;
} else {
// if singleview is shown with no tt_news uid given from GETvars (&tx_ttnews[tt_news]=) an error message is displayed.
$this->upstreamVars['mode'] = 'noNewsId';
$noNewsIdMsg = $this->local_cObj->stdWrap($this->pi_getLL('noNewsIdMsg'), $this->conf['noNewsIdMsg_stdWrap.']);
//.........这里部分代码省略.........