/**
  * @test
  * @dataProvider piSetPiVarDefaultsStdWrapProvider
  */
 public function piSetPiVarDefaultsStdWrap($input, $expected)
 {
     $this->abstractPlugin->piVars = $this->defaultPiVars;
     $this->abstractPlugin->conf['_DEFAULT_PI_VARS.'] = $input;
     $this->abstractPlugin->pi_setPiVarDefaults();
     $this->assertEquals($expected, $this->abstractPlugin->piVars);
 }
 /**
  * Main function, called from TypoScript
  * A content object that renders "tt_content" records. See the comment to this class for TypoScript example of how to trigger it.
  * This detects the CType of the current content element and renders it accordingly. Only wellknown types are rendered.
  *
  * @param	\TYPO3\CMS\Frontend\Plugin\AbstractPlugin	$invokingObj the tt_news object
  * @return	string			Plain text content
  */
 public function extraCodesProcessor(&$invokingObj)
 {
     $content = '';
     $this->conf = $invokingObj->conf;
     if ($this->conf['code'] == 'PLAINTEXT') {
         $this->cObj = $invokingObj->cObj;
         $this->config = $invokingObj->config;
         $this->tt_news_uid = $invokingObj->tt_news_uid;
         $this->enableFields = $invokingObj->enableFields;
         $this->sys_language_mode = $invokingObj->sys_language_mode;
         $this->templateCode = $invokingObj->templateCode;
         $this->renderPlainText = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_directmail_pi1');
         $this->renderPlainText->init($GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_directmail_pi1.']);
         $this->renderPlainText->cObj = $this->cObj;
         $this->renderPlainText->labelsList = 'tt_news_author_prefix,tt_news_author_date_prefix,tt_news_author_email_prefix,tt_news_short_header,tt_news_bodytext_header';
         $lines = array();
         $singleWhere = 'tt_news.uid=' . intval($this->tt_news_uid);
         $singleWhere .= ' AND type=0' . $this->enableFields;
         // type=0->only real news.
         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_news', $singleWhere);
         $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
         $GLOBALS['TYPO3_DB']->sql_free_result($res);
         // get the translated record if the content language is not the default language
         if ($GLOBALS['TSFE']->sys_language_content) {
             $OLmode = $this->sys_language_mode == 'strict' ? 'hideNonTranslated' : '';
             $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay('tt_news', $row, $GLOBALS['TSFE']->sys_language_content, $OLmode);
         }
         if (is_array($row)) {
             // Render the title
             $lines[] = $this->renderPlainText->renderHeader($row['title']);
             // Render author of the tt_news record
             $lines[] = $this->renderAuthor($row);
             // Render the short version of the tt_news record
             $lines[] = $this->renderPlainText->breakContent(strip_tags($this->renderPlainText->parseBody($row['short'], 'tt_news_short')));
             // Render the main text of the tt_news record
             $lines[] = $this->renderPlainText->breakContent(strip_tags($this->renderPlainText->parseBody($row['bodytext'], 'tt_news_bodytext')));
             // Render the images of the tt_news record.
             $lines[] = $this->getImages($row);
             // Render the downloads of the tt_news record.
             $lines[] = $this->renderPlainText->renderUploads($row['news_files']);
         } elseif ($this->sys_language_mode == 'strict' && $this->tt_news_uid) {
             $noTranslMsg = $this->cObj->stdWrap($invokingObj->pi_getLL('noTranslMsg', 'Sorry, there is no translation for this news-article'), $this->conf['noNewsIdMsg_stdWrap.']);
             $content .= $noTranslMsg;
         }
         if (!empty($lines)) {
             $content = implode(LF, $lines) . $content;
         }
         // Substitute labels
         if (!empty($content)) {
             $markerArray = array();
             $markerArray = $this->renderPlainText->addLabelsMarkers($markerArray);
             $content = $this->cObj->substituteMarkerArray($content, $markerArray);
         }
     }
     return $content;
 }
 /**
  * Wrapper function for retrieval of language dependent strings.
  * This function overrides the parent pi_getLL function. This was introduced
  * in order to allow language variables using TypoScript (which was until now
  * not possible due to the dots used in the language indices) by accessing
  * the same language label with dashes indead of dots. This function allows this
  * without changing all pi_getLL calls in this class.
  *
  * Furthermore, as of version 0.1.4, the function controls the use of
  * formal or informal language (which is mainly characterized by the use of the
  * german "Sie" or "Du").
  *
  * @param   string $key The language key
  * @return  string      The language dependent label
  * @author  Martin Helmich <*****@*****.**>
  * @version 2007-10-05
  */
 function pi_getLL($key)
 {
     $altKey = str_replace('.', '-', $key);
     // first check the alternative syntax with the "-"
     $llKey = parent::pi_getLL($altKey);
     if ($llKey) {
         // additionally check for the informal option (once we know there is a
         if ($this->conf['informal'] && parent::pi_getLL($altKey . '-inf')) {
             $llKey = parent::pi_getLL($altKey . '-inf');
         }
     } else {
         $llKey = parent::pi_getLL($key);
         if ($this->conf['informal'] && parent::pi_getLL($key . '-inf')) {
             $llKey = parent::pi_getLL($key . '-inf');
         }
     }
     return $llKey;
 }
 /**
  * The constructor for a view setting the component manager and the configuration.
  *
  * @param \Typoheads\Formhandler\Component\Manager $componentManager
  * @param \Typoheads\Formhandler\Controller\Configuration $configuration
  * @return void
  */
 public function __construct(\Typoheads\Formhandler\Component\Manager $componentManager, \Typoheads\Formhandler\Controller\Configuration $configuration, \Typoheads\Formhandler\Utility\Globals $globals, \Typoheads\Formhandler\Utility\GeneralUtility $utilityFuncs)
 {
     parent::__construct();
     $this->componentManager = $componentManager;
     $this->configuration = $configuration;
     $this->globals = $globals;
     $this->utilityFuncs = $utilityFuncs;
     $this->cObj = $this->globals->getCObj();
     $this->pi_loadLL();
     $this->initializeView();
 }
Example #5
0
 /**
  * Returns a frontend locallang value with all HTML entities replaced for display in browser
  *
  * @param   tslib_pibase      object of type tslib_pibase: TYPO3 frontend plugin derived from tslib_pibase
  * @param   string      locallang array key (of the plugins locallang.php file)
  * @return  string      value of the passed locallang array key with all HTML entities replaced for display in browser
  * @author  Rainer Kuhn 
  */
 public static function displayLL(\TYPO3\CMS\Frontend\Plugin\AbstractPlugin $callerObj, $LLkey)
 {
     return htmlentities($callerObj->pi_getLL($LLkey), ENT_QUOTES);
 }
Example #6
0
 /**
  * Modified function pi_linkTP.
  * It calls a function for cleaning up the piVars right before calling the original function.
  * Returns the $str wrapped in <a>-tags with a link to the CURRENT page, but with $urlParameters set as extra parameters for the page.
  *
  * @param
  *        	string		The content string to wrap in <a> tags
  * @param
  *        	array			Array with URL parameters as key/value pairs. They will be "imploded" and added to the list of parameters defined in the plugins TypoScript property "parent.addParams" plus $this->pi_moreParams.
  * @param
  *        	boolean		If $cache is set (0/1), the page is asked to be cached by a &cHash value (unless the current plugin using this class is a USER_INT). Otherwise the no_cache-parameter will be a part of the link.
  * @param
  *        	integer		Alternative page ID for the link. (By default this function links to the SAME page!)
  * @return string input string wrapped in <a> tags
  * @see pi_linkTP_keepPIvars(), \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::typoLink()
  */
 public function pi_linkTP($str, $urlParameters = array(), $cache = 0, $altPageId = 0)
 {
     $this->cleanupUrlParameter($urlParameters);
     $link = parent::pi_linkTP($str, $urlParameters, $cache, $altPageId);
     $this->pi_USER_INT_obj = 0;
     return $link;
 }
 /**
  * Initializing the parent class
  *
  * @param	array		$conf TS conf
  *
  * @return	void
  */
 public function init(array $conf)
 {
     AbstractPlugin::__construct();
     $this->conf = $conf;
     $this->pi_loadLL();
     $this->siteUrl = $this->conf['siteUrl'];
     // Default linebreak;
     if ($this->conf['flowedFormat']) {
         $this->linebreak = chr(32) . LF;
     }
 }
 /**
  * Returns the flexform value of the plugin that was passed as context plugin.
  *
  * @param $fieldName
  * @param string $sheet
  * @param string $language
  * @param string $value
  * @return NULL|string
  */
 protected function getFlexFormValueFromPluginContentObject($fieldName, $sheet = 'sDEF', $language = 'lDEF', $value = 'vDEF')
 {
     $flexFormData = $this->contextPlugin->cObj->data['pi_flexform'];
     return $this->contextPlugin->pi_getFFvalue($flexFormData, $fieldName, $sheet, $language, $value);
 }