/** * 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) { $theLink = $this->cObj->getTypoLink_URL($ll); if (substr($theLink, 0, 4) != 'http') { $theLink = $this->siteUrl . $theLink; } return $theLink; }
/** * 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 Tx_Solr_FormModifier */ public function execute() { $url = $this->cObj->getTypoLink_URL($this->parentPlugin->conf['search.']['targetPage']); $marker = array('action' => htmlspecialchars($url), 'action_id' => intval($this->parentPlugin->conf['search.']['targetPage']), '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 = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classReference); if ($formModifier instanceof Tx_Solr_FormModifier) { if ($formModifier instanceof Tx_Solr_CommandPluginAware) { $formModifier->setParentPlugin($this->parentPlugin); } $marker = $formModifier->modifyForm($marker, $this->parentPlugin->getTemplate()); } else { throw new InvalidArgumentException('Form modifier "' . $classReference . '" must implement the Tx_Solr_FormModifier interface.', 1262864703); } } } return $marker; }
/** * 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.']; $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 =& t3lib_div::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']; if (is_array($row) && ($row['pid'] > 0 || $this->vPrev)) { // never display versions of a news record (having pid=-1) for normal website users // If type is 1 or 2 (internal/external link), redirect to accordant page: if (is_array($row) && t3lib_div::inList('1,2', $row['type'])) { $redirectUrl = $this->local_cObj->getTypoLink_URL($row['type'] == 1 ? $row['page'] : $row['ext_url']); t3lib_utility_Http::redirect($redirectUrl); } $item = FALSE; // 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); // reset marker array $wrappedSubpartArray = array(); // 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'); // 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 $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 $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. $noNewsIdMsg = $this->local_cObj->stdWrap($this->pi_getLL('noNewsIdMsg'), $this->conf['noNewsIdMsg_stdWrap.']); $content = $noNewsIdMsg; } if ($this->debugTimes) { $this->hObj->getParsetime(__METHOD__); } return $content; }
/** * render the tags for one page (<loc> and <lastmod>) * * @param Tx_Hriseo_Domain_Model_Pages $page * @return string */ public function render($page) { $cObj = new tslib_cObj(); $path = $cObj->getTypoLink_URL($page->getUid()); return sprintf("Disallow: /%s", $path); }
/** * 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 integer Page id * @param string Target value to use. Affects the &type-value of the URL, defaults to current. * @param array Additional URL parameters to set (key/value pairs) * @return string The resulting URL * @see pi_linkToPage() */ function pi_getPageLink($id, $target = '', $urlParameters = array()) { return $this->cObj->getTypoLink_URL($id, $urlParameters, $target); // ?$target:$GLOBALS['TSFE']->sPre }
/** * render the tags for one page (<loc> and <lastmod>) * * @param Tx_Hriseo_Domain_Model_Pages $page * @return string */ public function render($page) { $cObj = new tslib_cObj(); $path = $cObj->getTypoLink_URL($page->getUid()); // @see http://sitemaps.org and // http://php.net/manual/de/function.htmlspecialchars.php $link = htmlspecialchars($this->settings['baseURL'] . $path, ENT_QUOTES, 'UTF-8', false); $this->loc->setContent($link); $ret = $this->loc->render(); $date = new DateTime(); $date->setTimestamp($page->getLastmod()); $this->lastmod->setContent($date->format('Y-m-d')); $ret .= $this->lastmod->render(); $changefreq = $page->getChangefreq(); if (!empty($changefreq)) { $this->tagBuilder->reset(); $this->tagBuilder->setTagName('changefreq'); $this->tagBuilder->setContent($changefreq); $ret .= $this->tagBuilder->render(); } $priority = $page->getPriority(); // 0.0: ignore // 0.5: default - do not display if (0 < $priority and 0.5 != $priority) { $this->tagBuilder->reset(); $this->tagBuilder->setTagName('priority'); $this->tagBuilder->setContent(number_format($priority, 1)); $ret .= $this->tagBuilder->render(); } return $ret; }