/**
  * get result url (not) linked
  * @return string The results URL
  */
 public function getResultUrl($linked = false)
 {
     $linkText = $this->cObj->typoLink_URL($this->getResultLinkConfiguration());
     $linkText = htmlspecialchars($linkText);
     if ($linked) {
         return $this->cObj->typoLink($linkText, $this->getResultLinkConfiguration());
     }
     return $linkText;
 }
示例#2
0
 /**
  * Builds the URI, frontend flavour
  *
  * @return string The URI
  * @see buildTypolinkConfiguration()
  */
 public function buildFrontendUri()
 {
     $typolinkConfiguration = $this->buildTypolinkConfiguration();
     if ($this->createAbsoluteUri === TRUE) {
         $typolinkConfiguration['forceAbsoluteUrl'] = TRUE;
     }
     $uri = $this->contentObject->typoLink_URL($typolinkConfiguration);
     return $uri;
 }
 /**
  * Send clear cache commands for pages to defined server
  *
  * @param string $table
  * @param integer $id
  * @param string $host
  * @param boolean $quote
  *
  * @return array
  */
 public function sendClearCacheCommandForTables($table, $uid, $host = '', $quote = TRUE)
 {
     // Get current record to process
     $record = t3lib_BEfunc::getRecord($table, $uid);
     // Build request
     if ($table === 'pages') {
         $pid = $record['uid'];
     } else {
         $pid = $record['pid'];
     }
     // Log debug information
     $logData = array('table' => $table, 'uid' => $uid, 'host' => $host, 'pid' => $pid);
     $this->loggingService->debug('CommunicationService::sendClearCacheCommandForTables arguments', $logData, $pid);
     $tsConfig = $this->tsConfigService->getConfiguration($pid);
     $typolink = $tsConfig[$table . '.']['typolink.'];
     $this->contentObject->data = $record;
     $url = $this->contentObject->typoLink_URL($typolink);
     $LD = $this->contentObject->lastTypoLinkLD;
     // Check for root site
     if ($url === '' && $table === 'pages') {
         $rootline = t3lib_BEfunc::BEgetRootLine($uid);
         if (is_array($rootline) && count($rootline) > 1) {
             // If uid equals the site root we have to process
             if ($uid == $rootline[1]['uid']) {
                 $url = '/';
             }
         }
     }
     // Log debug information
     $logData['url'] = $url;
     $this->loggingService->debug('CommunicationService::sendClearCacheCommandForTables built url', $logData, $pid);
     // Process only for valid URLs
     if ($url !== '') {
         $url = $this->removeHost($url);
         $responseArray = $this->processClearCacheCommand($url, $pid, $host, $quote);
         // Check support of index.php script
         if ($this->enableIndexScript) {
             $url = $LD['url'] . $LD['linkVars'];
             $url = $this->removeHost($url);
             $indexResponseArray = $this->processClearCacheCommand($url, $pid, $host, $quote);
             $responseArray = array_merge($responseArray, $indexResponseArray);
         }
         return $responseArray;
     }
     return array(array('status' => t3lib_FlashMessage::ERROR, 'message' => array('No valid URL was generated.', 'table: ' . $table, 'uid: ' . $uid, 'host: ' . $host), 'requestHeader' => array($url)));
 }
示例#4
0
 /**
  * Generates a URL.
  *
  * TODO currently everything in $additionalQueryParameters is prefixed with tx_solr,
  * allow arbitrary parameters, too (either filter them out or introduce a new 3rd parameter)
  *
  * @param array $additionalQueryParameters Additional query parameters
  * @param array $typolinkOptions Typolink Options
  * @return string A query URL
  */
 public function getQueryUrl(array $additionalQueryParameters = array(), array $typolinkOptions = array())
 {
     $queryParameters = array_merge($this->getPluginParameters(), $additionalQueryParameters);
     $queryParameters = $this->removeUnwantedUrlParameters($queryParameters);
     $queryKeywords = '';
     if ($this->query) {
         $queryKeywords = $this->query->getKeywords();
     }
     $queryGetParameter = '';
     if (!empty($queryKeywords)) {
         $queryGetParameter = '&q=' . $queryKeywords;
     }
     $linkConfiguration = array('useCacheHash' => FALSE, 'no_cache' => FALSE, 'parameter' => $this->linkTargetPageId, 'additionalParams' => $queryGetParameter . \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', array($this->prefix => $queryParameters), '', TRUE) . $this->getUrlParameters());
     // merge linkConfiguration with typolinkOptions
     $linkConfiguration = array_merge($linkConfiguration, $typolinkOptions);
     return htmlspecialchars($this->contentObject->typoLink_URL($linkConfiguration));
 }
 /**
  * Creates the URL, target and onclick values for the menu item link. Returns them in an array as key/value pairs for <A>-tag attributes
  * This function doesn't care about the url, because if we let the url be redirected, it will be logged in the stat!!!
  *
  * @param	integer		Pointer to a key in the $this->menuArr array where the value for that key represents the menu item we are linking to (page record)
  * @param	string		Alternative target
  * @param	integer		Alternative type
  * @return	array		Returns an array with A-tag attributes as key/value pairs (HREF, TARGET and onClick)
  * @access private
  */
 function link($key, $altTarget = '', $typeOverride = '')
 {
     // Mount points:
     $MP_var = $this->getMPvar($key);
     $MP_params = $MP_var ? '&MP=' . rawurlencode($MP_var) : '';
     // Setting override ID
     if ($this->mconf['overrideId'] || $this->menuArr[$key]['overrideId']) {
         $overrideArray = array();
         // If a user script returned the value overrideId in the menu array we use that as page id
         $overrideArray['uid'] = $this->mconf['overrideId'] ? $this->mconf['overrideId'] : $this->menuArr[$key]['overrideId'];
         $overrideArray['alias'] = '';
         $MP_params = '';
         // clear MP parameters since ID was changed.
     } else {
         $overrideArray = '';
     }
     // Setting main target:
     $mainTarget = $altTarget ? $altTarget : $this->mconf['target'];
     // Creating link:
     if ($this->mconf['collapse'] && $this->isActive($this->menuArr[$key]['uid'], $this->getMPvar($key))) {
         $thePage = $this->sys_page->getPage($this->menuArr[$key]['pid']);
         $LD = $this->menuTypoLink($thePage, $mainTarget, '', '', $overrideArray, $this->mconf['addParams'] . $MP_params . $this->menuArr[$key]['_ADD_GETVARS'], $typeOverride);
     } else {
         $LD = $this->menuTypoLink($this->menuArr[$key], $mainTarget, '', '', $overrideArray, $this->mconf['addParams'] . $MP_params . $this->I['val']['additionalParams'] . $this->menuArr[$key]['_ADD_GETVARS'], $typeOverride);
     }
     // Override URL if using "External URL" as doktype with a valid e-mail address:
     if ($this->menuArr[$key]['doktype'] == 3 && $this->menuArr[$key]['urltype'] == 3 && t3lib_div::validEmail($this->menuArr[$key]['url'])) {
         // Create mailto-link using tslib_cObj::typolink (concerning spamProtectEmailAddresses):
         $LD['totalURL'] = $this->parent_cObj->typoLink_URL(array('parameter' => $this->menuArr[$key]['url']));
         $LD['target'] = '';
     }
     // Manipulation in case of access restricted pages:
     $this->changeLinksForAccessRestrictedPages($LD, $this->menuArr[$key], $mainTarget, $typeOverride);
     // Overriding URL / Target if set to do so:
     if ($this->menuArr[$key]['_OVERRIDE_HREF']) {
         $LD['totalURL'] = $this->menuArr[$key]['_OVERRIDE_HREF'];
         if ($this->menuArr[$key]['_OVERRIDE_TARGET']) {
             $LD['target'] = $this->menuArr[$key]['_OVERRIDE_TARGET'];
         }
     }
     // OnClick open in windows.
     $onClick = '';
     if ($this->mconf['JSWindow']) {
         $conf = $this->mconf['JSWindow.'];
         $url = $LD['totalURL'];
         $LD['totalURL'] = '#';
         $onClick = 'openPic(\'' . $GLOBALS['TSFE']->baseUrlWrap($url) . '\',\'' . ($conf['newWindow'] ? md5($url) : 'theNewPage') . '\',\'' . $conf['params'] . '\'); return false;';
         $GLOBALS['TSFE']->setJS('openPic');
     }
     // look for type and popup
     // following settings are valid in field target:
     // 230								will add type=230 to the link
     // 230 500x600						will add type=230 to the link and open in popup window with 500x600 pixels
     // 230 _blank						will add type=230 to the link and open with target "_blank"
     // 230x450:resizable=0,location=1	will open in popup window with 500x600 pixels with settings "resizable=0,location=1"
     $matches = array();
     $targetIsType = $LD['target'] && (string) intval($LD['target']) == trim($LD['target']) ? intval($LD['target']) : FALSE;
     if (preg_match('/([0-9]+[\\s])?(([0-9]+)x([0-9]+))?(:.+)?/s', $LD['target'], $matches) || $targetIsType) {
         // has type?
         if (intval($matches[1]) || $targetIsType) {
             $LD['totalURL'] .= '&type=' . ($targetIsType ? $targetIsType : intval($matches[1]));
             $LD['target'] = $targetIsType ? '' : trim(substr($LD['target'], strlen($matches[1]) + 1));
         }
         // open in popup window?
         if ($matches[3] && $matches[4]) {
             $JSparamWH = 'width=' . $matches[3] . ',height=' . $matches[4] . ($matches[5] ? ',' . substr($matches[5], 1) : '');
             $onClick = 'vHWin=window.open(\'' . $LD['totalURL'] . '\',\'FEopenLink\',\'' . $JSparamWH . '\');vHWin.focus();return false;';
             $LD['target'] = '';
         }
     }
     // out:
     $list = array();
     $list['HREF'] = strlen($LD['totalURL']) ? $LD['totalURL'] : $GLOBALS['TSFE']->baseUrl;
     // Added this check: What it does is to enter the baseUrl (if set, which it should for "realurl" based sites) as URL if the calculated value is empty. The problem is that no link is generated with a blank URL and blank URLs might appear when the realurl encoding is used and a link to the frontpage is generated.
     $list['TARGET'] = $LD['target'];
     $list['onClick'] = $onClick;
     return $list;
 }