/**
  * Rendering the "clickenlarge" custom attribute, called from TypoScript
  *
  * @param	string		Content input. Not used, ignore.
  * @param	array		TypoScript configuration
  * @return	string		HTML output.
  * @access private
  */
 function render_clickenlarge($content, $conf)
 {
     $clickenlarge = isset($this->cObj->parameters['clickenlarge']) ? $this->cObj->parameters['clickenlarge'] : 0;
     $path = $this->cObj->parameters['src'];
     $pathPre = $GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir'] . 'RTEmagicC_';
     if (t3lib_div::isFirstPartOfStr($path, $pathPre)) {
         // Find original file:
         $pI = pathinfo(substr($path, strlen($pathPre)));
         $filename = substr($pI['basename'], 0, -strlen('.' . $pI['extension']));
         $file = $GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir'] . 'RTEmagicP_' . $filename;
     } else {
         $file = $this->cObj->parameters['src'];
     }
     unset($this->cObj->parameters['clickenlarge']);
     unset($this->cObj->parameters['allParams']);
     $content = '<img ' . t3lib_div::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;
 }
Exemplo n.º 2
0
 /**
  * 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('tslib_cObj');
     $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;
     }
 }
Exemplo n.º 3
0
 /**
  * Converts a given unix timestamp to a human readble 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;
 }
 /**
  * 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		The content to which the edit icons should be appended
  * @param	string		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		TypoScript properties for configuring the edit icons.
  * @param	string		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		Alternative data array to use. Default is $this->data
  * @param	string		Additional URL parameters for the link pointing to alt_doc.php
  * @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 src="' . TYPO3_mainDir . 'gfx/edit_fe.gif" width="11" height="12" border="0" align="top" title="' . t3lib_div::deHSCentities(htmlspecialchars($iconTitle)) . '"' . $style . ' class="frontEndEditIcons" alt="" />';
     $nV = t3lib_div::_GP('ADMCMD_view') ? 1 : 0;
     $adminURL = t3lib_div::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;
 }
 /**
  * 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
  */
 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 "";
 }
 /**
  * Find and highlight the searchwords
  *
  * @param array $wordArray
  * @param string $content
  * @return string The content with highlighted searchwords
  */
 public function highlightArrayOfWordsInContent($wordArray, $content)
 {
     if (is_array($wordArray) && count($wordArray)) {
         $highlightedWord = !empty($this->conf['highlightedWord_stdWrap.']) ? $this->cObj->stdWrap('\\0', $this->conf['highlightedWord_stdWrap.']) : '<span class="hit">\\0</span>';
         foreach ($wordArray as $word) {
             $word = str_replace('/', '\\/', $word);
             $word = htmlspecialchars($word);
             $content = preg_replace('/(' . $word . ')/iu', $highlightedWord, $content);
         }
     }
     return $content;
 }
Exemplo n.º 7
0
 /**
  * Gets the raw content as configured - a certain value or database field.
  *
  * @param	tslib_cObj	$contentObject The original content object
  * @param	array	$configuration content object configuration
  * @return	string	The raw content
  */
 protected function getRawContent($contentObject, $configuration)
 {
     $content = '';
     if (isset($configuration['value'])) {
         $content = $configuration['value'];
         unset($configuration['value']);
     }
     if (!empty($configuration)) {
         $content = $contentObject->stdWrap($content, $configuration);
     }
     return $content;
 }
Exemplo n.º 8
0
 /**
  * Renders the author and date columns of the tt_news record
  *
  * @param	string	$row: The tt_news record
  * @param	int		$type:
  * @return	string	Content
  */
 function renderAuthor($row, $type = 0)
 {
     if ($row['author']) {
         $hConf = $this->renderPlainText->conf['tt_news_author.'];
         $str = $this->renderPlainText->getString($hConf['prefix']) . $row['author'] . $this->renderPlainText->getString($hConf['emailPrefix']) . '<' . $row['author_email'] . '>';
         $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 . '.'];
             $lines = array();
             $blanks = DirectMailUtility::intInRangeWrapper($tConf['preBlanks'], 0, 1000);
             if ($blanks) {
                 $lines[] = str_pad('', $blanks - 1, LF);
             }
             $lines = $this->renderPlainText->pad($lines, $tConf['preLineChar'], $tConf['preLineLen']);
             $blanks = DirectMailUtility::intInRangeWrapper($tConf['preLineBlanks'], 0, 1000);
             if ($blanks) {
                 $lines[] = str_pad('', $blanks - 1, LF);
             }
             if ($row['datetime']) {
                 $lConf = $this->conf['displaySingle.'];
                 $lines[] = $this->renderPlainText->getString($hConf['datePrefix']) . $this->cObj->stdWrap($row['datetime'], $lConf['date_stdWrap.']) . ' ' . $this->cObj->stdWrap($row['datetime'], $lConf['time_stdWrap.']);
             }
             $lines[] = $this->cObj->stdWrap($str, $tConf['stdWrap.']);
             $blanks = DirectMailUtility::intInRangeWrapper($tConf['postLineBlanks'], 0, 1000);
             if ($blanks) {
                 $lines[] = str_pad('', $blanks - 1, LF);
             }
             $lines = $this->renderPlainText->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 "";
 }
Exemplo n.º 9
0
 /**
  * Executes the SOLR_MULTIVALUE content object.
  *
  * Turns a list of values into an array that can then be used to fill
  * multivalued fields in a Solr document. The array is returned in
  * serialized form as content objects are expected to return strings.
  *
  * @param	string	$name content object name 'SOLR_MULTIVALUE'
  * @param	array	$configuration for the content object, expects keys 'separator' and 'field'
  * @param	string	$TyposcriptKey not used
  * @param	tslib_cObj	$contentObject parent cObj
  * @return	string	serialized array representation of the given list
  */
 public function cObjGetSingleExt($name, array $configuration, $TyposcriptKey, $contentObject)
 {
     $data = '';
     if (isset($configuration['value'])) {
         $data = $configuration['value'];
         unset($configuration['value']);
     }
     if (!empty($configuration)) {
         $data = $contentObject->stdWrap($data, $configuration);
     }
     if (!array_key_exists('separator', $configuration)) {
         $configuration['separator'] = ',';
     }
     $removeEmptyValues = TRUE;
     if (isset($configuration['removeEmptyValues']) && $configuration['removeEmptyValues'] == 0) {
         $removeEmptyValues = FALSE;
     }
     $listAsArray = t3lib_div::trimExplode($configuration['separator'], $data, $removeEmptyValues);
     if (!empty($configuration['removeDuplicateValues'])) {
         $listAsArray = array_unique($listAsArray);
     }
     return serialize($listAsArray);
 }
Exemplo n.º 10
0
 /**
  * Format string with general_stdWrap from configuration
  *
  * @param	string	$str	string to wrap
  * @return	string		wrapped string
  */
 function formatStr($str)
 {
     if (is_array($this->conf['general_stdWrap.'])) {
         $str = $this->local_cObj->stdWrap($str, $this->conf['general_stdWrap.']);
     }
     return $str;
 }
 /**
  * Creates a submenu level to the current level - if configured for.
  *
  * @param	integer		Page id of the current page for which a submenu MAY be produced (if conditions are met)
  * @param	string		Object prefix, see ->start()
  * @return	string		HTML content of the submenu
  * @access private
  */
 function subMenu($uid, $objSuffix = '')
 {
     // Setting alternative menu item array if _SUB_MENU has been defined in the current ->menuArr
     $altArray = '';
     if (is_array($this->menuArr[$this->I['key']]['_SUB_MENU']) && count($this->menuArr[$this->I['key']]['_SUB_MENU'])) {
         $altArray = $this->menuArr[$this->I['key']]['_SUB_MENU'];
     }
     // Make submenu if the page is the next active
     $cls = strtolower($this->conf[$this->menuNumber + 1 . $objSuffix]);
     $subLevelClass = $cls && t3lib_div::inList($this->tmpl->menuclasses, $cls) ? $cls : '';
     // stdWrap for expAll
     if (isset($this->mconf['expAll.'])) {
         $this->mconf['expAll'] = $this->parent_cObj->stdWrap($this->mconf['expAll'], $this->mconf['expAll.']);
     }
     if ($subLevelClass && ($this->mconf['expAll'] || $this->isNext($uid, $this->getMPvar($this->I['key'])) || is_array($altArray)) && !$this->mconf['sectionIndex']) {
         $submenu = t3lib_div::makeInstance('tslib_' . $subLevelClass);
         $submenu->entryLevel = $this->entryLevel + 1;
         $submenu->rL_uidRegister = $this->rL_uidRegister;
         $submenu->MP_array = $this->MP_array;
         if ($this->menuArr[$this->I['key']]['_MP_PARAM']) {
             $submenu->MP_array[] = $this->menuArr[$this->I['key']]['_MP_PARAM'];
         }
         // especially scripts that build the submenu needs the parent data
         $submenu->parent_cObj = $this->parent_cObj;
         $submenu->parentMenuArr = $this->menuArr;
         // Setting alternativeMenuTempArray (will be effective only if an array)
         if (is_array($altArray)) {
             $submenu->alternativeMenuTempArray = $altArray;
         }
         if ($submenu->start($this->tmpl, $this->sys_page, $uid, $this->conf, $this->menuNumber + 1, $objSuffix)) {
             $submenu->makeMenu();
             return $submenu->writeMenu();
         }
     }
 }