/**
  * Process the link generation
  *
  * @param string $linkText
  * @param array $typoLinkConfiguration TypoLink Configuration array
  * @param string $linkHandlerKeyword Define the identifier that an record is given
  * @param string $linkHandlerValue Table and uid of the requested record like "tt_news:2"
  * @param string $linkParameters Full link params like "record:tt_news:2"
  * @param \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObjectRenderer
  * @return string
  */
 public function main($linkText, array $typoLinkConfiguration, $linkHandlerKeyword, $linkHandlerValue, $linkParameters, \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObjectRenderer)
 {
     $typoScriptConfiguration = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_linkhandler.'];
     $generatedLink = $linkText;
     // extract link params like "target", "css-class" or "title"
     $additionalLinkParameters = str_replace('"' . $linkHandlerKeyword . ':' . $linkHandlerValue . '"', '', $linkParameters);
     $additionalLinkParameters = str_replace($linkHandlerKeyword . ':' . $linkHandlerValue, '', $additionalLinkParameters);
     list($recordTableName, $recordUid) = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(':', $linkHandlerValue);
     $recordArray = $this->getCurrentRecord($recordTableName, $recordUid);
     if ($recordArray && $this->isRecordLinkable($recordTableName, $typoScriptConfiguration, $recordArray)) {
         $this->localContentObject = clone $contentObjectRenderer;
         $this->localContentObject->start($recordArray, '');
         unset($typoLinkConfiguration['parameter']);
         $typoScriptConfiguration[$recordTableName . '.']['parameter'] .= $additionalLinkParameters;
         $currentLinkConfigurationArray = $this->mergeTypoScript($typoScriptConfiguration, $typoLinkConfiguration, $recordTableName);
         if (isset($currentLinkConfigurationArray['storagePidParameterOverride.'])) {
             if (array_key_exists($recordArray['pid'], $currentLinkConfigurationArray['storagePidParameterOverride.'])) {
                 $currentLinkConfigurationArray['parameter'] = $currentLinkConfigurationArray['storagePidParameterOverride.'][$recordArray['pid']];
             }
         }
         // build the full link to the record
         $generatedLink = $this->localContentObject->typoLink($linkText, $currentLinkConfigurationArray);
         $this->updateParentLastTypoLinkMember($contentObjectRenderer);
     }
     return $generatedLink;
 }
 /**
  * Constructor for the edit panel
  *
  * @param DatabaseConnection $databaseConnection
  * @param TypoScriptFrontendController $frontendController
  * @param FrontendBackendUserAuthentication $backendUser
  */
 public function __construct(DatabaseConnection $databaseConnection = NULL, TypoScriptFrontendController $frontendController = NULL, FrontendBackendUserAuthentication $backendUser = NULL)
 {
     $this->databaseConnection = $databaseConnection ?: $GLOBALS['TYPO3_DB'];
     $this->frontendController = $frontendController ?: $GLOBALS['TSFE'];
     $this->backendUser = $backendUser ?: $GLOBALS['BE_USER'];
     $this->cObj = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
     $this->cObj->start(array());
 }
 /**
  * @test
  */
 public function convertsCommaSeparatedListFromValueToSerializedArrayOfTrimmedValues()
 {
     $list = 'abc, def, ghi, jkl, mno, pqr, stu, vwx, yz';
     $expected = 'a:9:{i:0;s:3:"abc";i:1;s:3:"def";i:2;s:3:"ghi";i:3;s:3:"jkl";i:4;s:3:"mno";i:5;s:3:"pqr";i:6;s:3:"stu";i:7;s:3:"vwx";i:8;s:2:"yz";}';
     $this->contentObject->start(array());
     $actual = $this->contentObject->cObjGetSingle(\Tx_Solr_contentobject_Multivalue::CONTENT_OBJECT_NAME, array('value' => $list, 'separator' => ','));
     $this->assertEquals($expected, $actual);
 }
Exemple #4
0
 /**
  * Constructor for the edit panel
  *
  * @param mixed $_ Previous the database connection
  * @param TypoScriptFrontendController $frontendController
  * @param FrontendBackendUserAuthentication $backendUser
  */
 public function __construct($_ = null, TypoScriptFrontendController $frontendController = null, FrontendBackendUserAuthentication $backendUser = null)
 {
     $this->frontendController = $frontendController ?: $GLOBALS['TSFE'];
     $this->backendUser = $backendUser ?: $GLOBALS['BE_USER'];
     $this->cObj = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
     $this->cObj->start([]);
     $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
 }
 /**
  * Initializes the instance of this class. This constructir sets starting
  * point for the sitemap to the current page id
  */
 public function __construct()
 {
     $this->cObj = GeneralUtility::makeInstance('tslib_cObj');
     $this->cObj->start(array());
     $this->offset = max(0, intval(GeneralUtility::_GET('offset')));
     $this->limit = max(0, intval(GeneralUtility::_GET('limit')));
     if ($this->limit <= 0) {
         $this->limit = 50000;
     }
     $this->createRenderer();
 }
 /**
  * Initializes the instance of this class. This constructir sets starting
  * point for the sitemap to the current page id
  */
 public function __construct()
 {
     $this->cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
     $this->cObj->start(array());
     $this->offset = max(0, (int) GeneralUtility::_GET('offset'));
     $this->limit = max(0, (int) GeneralUtility::_GET('limit'));
     if ($this->limit <= 0) {
         $this->limit = 50000;
     }
     $this->createRenderer();
 }
 /**
  * Manipulate values through TypoScript before rendering
  *
  * @param Answer $answer
  * @param string $type "createAction", "confirmationAction", "sender", "receiver"
  * @return string
  */
 public function render(Answer $answer, $type)
 {
     $value = $this->renderChildren();
     if ($answer->getField()) {
         if (!empty($this->typoScriptContext[$this->typeToTsType[$type] . '.'][$answer->getField()->getMarker()])) {
             $this->contentObjectRenderer->start($answer->_getProperties());
             $value = $this->contentObjectRenderer->cObjGetSingle($this->typoScriptContext[$this->typeToTsType[$type] . '.'][$answer->getField()->getMarker()], $this->typoScriptContext[$this->typeToTsType[$type] . '.'][$answer->getField()->getMarker() . '.']);
         }
     }
     return $value;
 }
 /**
  * Renders the view
  *
  * @return string The rendered view
  * @api
  */
 public function render()
 {
     $this->contentObjectRenderer->start($this->variables['data'], 'pages');
     $this->settings = $this->variables['settings'];
     $this->page = $this->factory->createFromAssociativeArray($this->variables['data']);
     $data = ['@context' => ['@vocab' => 'https://schema.org/'], '@type' => 'BlogPosting', '@id' => $this->getGlobalIdentifier(), 'dateModified' => $this->page->getLastUpdatedAt()->format('Y-m-d'), 'datePublished' => $this->page->getCreatedAt()->format('Y-m-d'), 'author' => $this->getAuthor(), 'publisher' => $this->getPublisher(), 'headline' => $this->page->getTitle(), 'description' => strip_tags($this->page->getAbstract()), 'keywords' => $this->page->getKeywords(), 'mainEntityOfPage' => ['@id' => $this->getGlobalIdentifier()]];
     $teaserImage = $this->page->getTeaserImage();
     if (!is_null($teaserImage)) {
         $data['image'] = ['@type' => 'ImageObject', 'url' => '/' . $teaserImage->getValue(), 'width' => '546', 'height' => '171'];
     }
     return json_encode($data, JSON_PRETTY_PRINT | JSON_FORCE_OBJECT);
 }
 /**
  * Preperation function for every table
  *
  * @return void
  */
 public function savePreflightFinisher()
 {
     if ($this->isSaveToAnyTableActivated()) {
         $this->addArrayToDataArray($this->mailRepository->getVariablesWithMarkersFromMail($this->mail));
         foreach ((array) array_keys($this->configuration) as $tableKey) {
             $table = StringUtility::removeLastDot($tableKey);
             $this->contentObject->start($this->getDataArray());
             $tableConfiguration = $this->configuration[$tableKey];
             if ($this->isSaveToAnyTableActivatedForSpecifiedTable($tableConfiguration)) {
                 $this->saveSpecifiedTablePreflight($table, $tableConfiguration);
             }
         }
     }
 }
 public function setUp()
 {
     $this->template = $this->getMock('TYPO3\\CMS\\Core\\TypoScript\\TemplateService', array('getFileName', 'linkData'));
     $this->tsfe = $this->getMock('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', array(), array(), '', FALSE);
     $this->tsfe->tmpl = $this->template;
     $this->tsfe->config = array();
     $sysPageMock = $this->getMock('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
     $this->tsfe->sys_page = $sysPageMock;
     $GLOBALS['TSFE'] = $this->tsfe;
     $GLOBALS['TSFE']->csConvObj = new \TYPO3\CMS\Core\Charset\CharsetConverter();
     $GLOBALS['TSFE']->renderCharset = 'utf-8';
     $GLOBALS['TYPO3_CONF_VARS']['SYS']['TYPO3\\CMS\\Core\\Charset\\CharsetConverter_utils'] = 'mbstring';
     $this->cObj = $this->getAccessibleMock('\\TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer', array('dummy'));
     $this->cObj->start(array(), 'tt_content');
 }
 /**
  * SendPost - Send values via curl to target
  *
  * @param User $user User properties
  * @return void
  */
 public function send(User $user)
 {
     $this->initialize($user);
     $this->contentObject->start($this->properties);
     if ($this->isTurnedOn()) {
         $curlObject = curl_init();
         curl_setopt($curlObject, CURLOPT_URL, $this->getUri());
         curl_setopt($curlObject, CURLOPT_POST, 1);
         curl_setopt($curlObject, CURLOPT_POSTFIELDS, $this->getData());
         curl_setopt($curlObject, CURLOPT_RETURNTRANSFER, true);
         curl_exec($curlObject);
         curl_close($curlObject);
         $this->log();
     }
 }
 /**
  * Initialize
  *
  * @return void
  */
 public function initializeFinisher()
 {
     $this->contentObject = $this->configurationManager->getContentObject();
     $this->contentObject->start($this->mailRepository->getVariablesWithMarkersFromMail($this->mail));
     $typoScript = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
     $this->configuration = $typoScript['plugin.']['tx_powermail.']['settings.']['setup.']['marketing.']['sendPost.'];
 }
 /**
  * Get from TypoScript content object like
  *
  *        # direct value
  *        plugin.tx_powermail.settings.setup.prefill.marker = TEXT
  *        plugin.tx_powermail.settings.setup.prefill.marker.value = red
  *
  *        # multiple value
  *        plugin.tx_powermail.settings.setup.prefill.marker.0 = TEXT
  *        plugin.tx_powermail.settings.setup.prefill.marker.0.value = red
  *
  * @return bool
  */
 protected function getFromTypoScriptContentObject()
 {
     $selected = false;
     if (isset($this->settings['prefill.'][$this->getMarker() . '.']) && is_array($this->settings['prefill.'][$this->getMarker() . '.'])) {
         $this->contentObjectRenderer->start(ObjectAccess::getGettableProperties($this->getField()));
         // Multivalue
         if (isset($this->settings['prefill.'][$this->getMarker() . '.']['0'])) {
             foreach (array_keys($this->settings['prefill.'][$this->getMarker() . '.']) as $key) {
                 if (stristr($key, '.')) {
                     continue;
                 }
                 $prefill = $this->contentObjectRenderer->cObjGetSingle($this->settings['prefill.'][$this->getMarker() . '.'][$key], $this->settings['prefill.'][$this->getMarker() . '.'][$key . '.']);
                 if ($prefill === $this->options[$this->index]['value'] || $prefill === $this->options[$this->index]['label']) {
                     $selected = true;
                 }
             }
         } else {
             // Single value
             $prefill = $this->contentObjectRenderer->cObjGetSingle($this->settings['prefill.'][$this->getMarker()], $this->settings['prefill.'][$this->getMarker() . '.']);
             if ($prefill === $this->options[$this->index]['value'] || $prefill === $this->options[$this->index]['label']) {
                 $selected = true;
             }
         }
     }
     return $selected;
 }
 /**
  * renders the columns of the grid container and returns the actual content
  *
  * @param $columns
  * @param array $child
  * @param array $parentGridData
  * @param array $parentRecordNumbers
  * @param array $typoScriptSetup
  *
  * @return void
  */
 public function renderChildIntoParentColumn($columns, &$child, &$parentGridData, &$parentRecordNumbers, $typoScriptSetup = array())
 {
     $column_number = (int) $child['tx_gridelements_columns'];
     $columnKey = $column_number . '.';
     if (!isset($typoScriptSetup['columns.'][$columnKey])) {
         $columnSetupKey = 'default.';
     } else {
         $columnSetupKey = $columnKey;
     }
     if ($child['uid'] > 0) {
         // update SYS_LASTCHANGED if necessary
         $this->cObj->lastChanged($child['tstamp']);
         $this->cObj->start(array_merge($child, $parentGridData), 'tt_content');
         $parentRecordNumbers[$columnKey]++;
         $this->cObj->parentRecordNumber = $parentRecordNumbers[$columnKey];
         // we render each child into the children key to provide them prerendered for usage with your own templating
         $child = $this->cObj->cObjGetSingle($typoScriptSetup['columns.'][$columnSetupKey]['renderObj'], $typoScriptSetup['columns.'][$columnSetupKey]['renderObj.']);
         // then we assign the prerendered child to the appropriate column
         if (isset($columns[$column_number])) {
             $parentGridData['tx_gridelements_view_columns'][$column_number] .= $child;
         }
         unset($columns);
     }
     unset($typoScriptSetup);
 }
 /**
  * Generates a typolink by using the matching configuration.
  *
  * @throws \Exception
  * @return string
  */
 protected function generateLink()
 {
     if (!array_key_exists($this->configurationKey, $this->configuration)) {
         throw new MissingConfigurationException(sprintf('No linkhandler TypoScript configuration found for key %s.', $this->configurationKey), 1448384257);
     }
     $typoScriptConfiguration = $this->configuration[$this->configurationKey]['typolink.'];
     try {
         $this->initRecord();
     } catch (RecordNotFoundException $e) {
         // Unless linking is forced, return only the link text
         // @todo: should we not get the record in this case (using \TYPO3\CMS\Frontend\Page\PageRepository::getRawRecord()) otherwise link generation will be pretty meaningless?
         if (!$this->configuration[$this->configurationKey]['forceLink']) {
             return $this->linkText;
         }
     }
     // Assemble full parameters syntax with additional attributes like target, class or title
     $this->linkParameters['url'] = $typoScriptConfiguration['parameter'];
     $typoScriptConfiguration['parameter'] = GeneralUtility::makeInstance(TypoLinkCodecService::class)->encode($this->linkParameters);
     $hookParams = array('linkInformation' => &$this->linkParameters, 'typoscriptConfiguration' => &$typoScriptConfiguration, 'linkText' => &$this->linkText, 'recordRow' => &$this->record);
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkhandler']['generateLink'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkhandler']['generateLink'] as $funcRef) {
             // @todo: make that clean with an interface
             GeneralUtility::callUserFunction($funcRef, $hookParams, $this);
         }
     }
     // Build the full link to the record
     $this->localContentObjectRenderer->start($this->record, $this->table);
     $this->localContentObjectRenderer->parameters = $this->contentObjectRenderer->parameters;
     $link = $this->localContentObjectRenderer->typoLink($this->linkText, $typoScriptConfiguration);
     // Make the typolink data available in the parent content object
     $this->contentObjectRenderer->lastTypoLinkLD = $this->localContentObjectRenderer->lastTypoLinkLD;
     $this->contentObjectRenderer->lastTypoLinkUrl = $this->localContentObjectRenderer->lastTypoLinkUrl;
     $this->contentObjectRenderer->lastTypoLinkTarget = $this->localContentObjectRenderer->lastTypoLinkTarget;
     return $link;
 }
 /**
  * Preperation function for every table
  *
  * @return void
  */
 public function savePreflightFinisher()
 {
     if ($this->isConfigurationAvailable()) {
         foreach (array_keys($this->configuration) as $key) {
             $this->contentObject->start($this->getDataArray());
             $tableConfiguration = $this->configuration[$key];
             $numberKey = StringUtility::removeLastDot($key);
             if ($this->isSaveToAnyTableActivatedForSpecifiedTable($tableConfiguration)) {
                 if (!$this->isDeprecatedConfiguration($numberKey)) {
                     $this->saveSpecifiedTablePreflight($numberKey, $tableConfiguration);
                 } else {
                     $this->saveSpecifiedTableDeprecatedPreflight($numberKey, $tableConfiguration);
                 }
             }
         }
     }
 }
 /**
  * Store for a given table
  *
  * @param string $table
  * @return void
  */
 protected function storeForTable($table)
 {
     if ($this->isTableEnabled($table)) {
         $this->contentObject->start($this->getDataArray());
         /** @var StoreInDatabaseService $storeInDatabase */
         $storeInDatabase = $this->objectManager->get(StoreInDatabaseService::class);
         $storeInDatabase->setTable($table);
         $this->setPropertiesForTable($table, $storeInDatabase);
         $this->addArrayToDataArray(['uid_' . $table => $storeInDatabase->execute()]);
     }
 }
 /**
  * Renders the wrapped term using the plugin settings
  *
  * @param \Dpn\DpnGlossary\Domain\Model\Term
  * @return string
  */
 protected function termWrapper(Term $term)
 {
     // get content object type
     $contentObjectType = $this->tsConfig['settings.']['termWraps'];
     // get term wrapping settings
     $wrapSettings = $this->tsConfig['settings.']['termWraps.'];
     // pass term data to the cObject pseudo constructor
     $this->cObj->start($term->toArray());
     // return the wrapped term
     return $this->cObj->cObjGetSingle($contentObjectType, $wrapSettings);
 }
 /**
  * Set up
  */
 protected function setUp()
 {
     $this->singletonInstances = GeneralUtility::getSingletonInstances();
     $this->createMockedLoggerAndLogManager();
     $this->templateServiceMock = $this->getMock(TemplateService::class, array('getFileName'));
     $pageRepositoryMock = $this->getMock(PageRepository::class, array('getPage'));
     $this->typoScriptFrontendControllerMock = $this->getAccessibleMock(TypoScriptFrontendController::class, array('dummy'), array(), '', false);
     $this->typoScriptFrontendControllerMock->tmpl = $this->templateServiceMock;
     $this->typoScriptFrontendControllerMock->config = array();
     $this->typoScriptFrontendControllerMock->page = array();
     $this->typoScriptFrontendControllerMock->sys_page = $pageRepositoryMock;
     $this->typoScriptFrontendControllerMock->csConvObj = new CharsetConverter();
     $this->typoScriptFrontendControllerMock->renderCharset = 'utf-8';
     $GLOBALS['TSFE'] = $this->typoScriptFrontendControllerMock;
     $GLOBALS['TT'] = $this->getMock(TimeTracker::class, array('dummy'));
     $GLOBALS['TYPO3_DB'] = $this->getMock(DatabaseConnection::class, array());
     $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = '12345';
     $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['urlProcessing']['urlProcessors']['jumpurl']['processor'] = JumpUrlProcessor::class;
     $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['urlProcessing']['urlHandlers']['jumpurl']['handler'] = JumpUrlHandler::class;
     $this->subject = $this->getAccessibleMock(ContentObjectRenderer::class, array('getResourceFactory', 'getEnvironmentVariable'), array($this->typoScriptFrontendControllerMock));
     $this->subject->start(array(), 'tt_content');
 }
Exemple #20
0
	/**
	 * Make sure the hook in get sourceCollection is called
	 *
	 * @test
	 */
	public function getImageSourceCollectionHookCalled() {
		$this->subject = $this->getAccessibleMock(
			\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class,
			array('getResourceFactory', 'stdWrap', 'getImgResource')
		);
		$this->subject->start(array(), 'tt_content');

		// Avoid calling stdwrap and getImgResource
		$this->subject->expects($this->any())
			->method('stdWrap')
			->will($this->returnArgument(0));

		$this->subject->expects($this->any())
			->method('getImgResource')
			->will($this->returnValue(array(100, 100, NULL, 'bar-file.jpg')));

		$resourceFactory = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceFactory::class, array(), array(), '', FALSE);
		$this->subject->expects($this->any())->method('getResourceFactory')->will($this->returnValue($resourceFactory));

		$className = $this->getUniqueId('tx_coretest_getImageSourceCollectionHookCalled');
		$getImageSourceCollectionHookMock = $this->getMock(\TYPO3\CMS\Frontend\ContentObject\ContentObjectOneSourceCollectionHookInterface::class, array('getOneSourceCollection'), array(), $className);
		$GLOBALS['T3_VAR']['getUserObj'][$className] = $getImageSourceCollectionHookMock;
		$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['getImageSourceCollection'][] = $className;

		$getImageSourceCollectionHookMock
			->expects($this->exactly(1))
			->method('getOneSourceCollection')
			->will($this->returnCallback(array($this, 'isGetOneSourceCollectionCalledCallback')));

		$configuration = array(
			'layoutKey' => 'data',
			'layout.' => array (
				'data.' => array(
					'element' => '<img src="###SRC###" ###SOURCECOLLECTION### ###PARAMS### ###ALTPARAMS######SELFCLOSINGTAGSLASH###>',
					'source' => 'data-###DATAKEY###="###SRC###"'
				)
			),
			'sourceCollection.' => array(
				'small.' => array(
					'width' => '200',
					'srcsetCandidate' => '600w',
					'mediaQuery' => '(max-device-width: 600px)',
					'dataKey' => 'small',
				),
			),
		);

		$result = $this->subject->getImageSourceCollection('data', $configuration, $this->getUniqueId('testImage-'));

		$this->assertSame($result, 'isGetOneSourceCollectionCalledCallback');
	}
 /**
  * Get from TypoScript content object like
  *
  *        # direct value
  *        plugin.tx_powermail.settings.setup.prefill.marker = TEXT
  *        plugin.tx_powermail.settings.setup.prefill.marker.value = red
  *
  *        # multiple value
  *        plugin.tx_powermail.settings.setup.prefill.marker.0 = TEXT
  *        plugin.tx_powermail.settings.setup.prefill.marker.0.value = red
  *
  * @return array|string
  */
 protected function getFromTypoScriptContentObject()
 {
     $value = '';
     if (isset($this->settings['prefill.'][$this->getMarker() . '.']) && is_array($this->settings['prefill.'][$this->getMarker() . '.'])) {
         $this->contentObjectRenderer->start(ObjectAccess::getGettableProperties($this->getField()));
         // Multivalue
         if (isset($this->settings['prefill.'][$this->getMarker() . '.']['0'])) {
             $value = array();
             foreach (array_keys($this->settings['prefill.'][$this->getMarker() . '.']) as $key) {
                 if (stristr($key, '.')) {
                     continue;
                 }
                 $value[] = $this->contentObjectRenderer->cObjGetSingle($this->settings['prefill.'][$this->getMarker() . '.'][$key], $this->settings['prefill.'][$this->getMarker() . '.'][$key . '.']);
             }
         } else {
             // Single value
             $value = $this->contentObjectRenderer->cObjGetSingle($this->settings['prefill.'][$this->getMarker()], $this->settings['prefill.'][$this->getMarker() . '.']);
         }
     }
     return $value;
 }
 /**
  * This is the main-function for sending Mails
  *
  * @param array $email Array with all needed mail information
  *        $email['receiverName'] = 'Name';
  *        $email['receiverEmail'] = '*****@*****.**';
  *        $email['senderName'] = 'Name';
  *        $email['senderEmail'] = '*****@*****.**';
  *        $email['subject'] = 'Subject line';
  *        $email['template'] = 'PathToTemplate/';
  *        $email['rteBody'] = 'This is the <b>content</b> of the RTE';
  *        $email['format'] = 'both'; // or plain or html
  * @param Mail &$mail
  * @param array $settings TypoScript Settings
  * @param string $type Email to "sender" or "receiver"
  * @return bool Mail successfully sent
  */
 public function sendEmailPreflight(array $email, Mail &$mail, $settings, $type = 'receiver')
 {
     $this->mail =& $mail;
     $this->settings = $settings;
     $this->configuration = $this->getConfigurationFromSettings($settings);
     $this->overwriteConfig = $this->configuration[$type . '.']['overwrite.'];
     $this->contentObject->start($this->mailRepository->getVariablesWithMarkersFromMail($mail));
     $this->type = $type;
     $this->parseVariables($email, $mail);
     if ($settings['debug']['mail']) {
         GeneralUtility::devLog('Mail properties', 'powermail', 0, $email);
     }
     if (!GeneralUtility::validEmail($email['receiverEmail']) || !GeneralUtility::validEmail($email['senderEmail'])) {
         return false;
     }
     if (empty($email['subject'])) {
         // don't want an error flashmessage
         return true;
     }
     return $this->sendTemplateEmail($email);
 }
Exemple #23
0
 /**
  * Renders the TypoScript object in the given TypoScript setup path.
  *
  * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception
  * @return string the content of the rendered TypoScript object
  */
 public function render()
 {
     $typoscriptObjectPath = $this->arguments['typoscriptObjectPath'];
     $data = $this->arguments['data'];
     $currentValueKey = $this->arguments['currentValueKey'];
     $table = $this->arguments['table'];
     if (TYPO3_MODE === 'BE') {
         $this->simulateFrontendEnvironment();
     }
     if ($data === null) {
         $data = $this->renderChildren();
     }
     $currentValue = null;
     if (is_object($data)) {
         $data = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getGettableProperties($data);
     } elseif (is_string($data) || is_numeric($data)) {
         $currentValue = (string) $data;
         $data = [$data];
     }
     $this->contentObjectRenderer->start($data, $table);
     if ($currentValue !== null) {
         $this->contentObjectRenderer->setCurrentVal($currentValue);
     } elseif ($currentValueKey !== null && isset($data[$currentValueKey])) {
         $this->contentObjectRenderer->setCurrentVal($data[$currentValueKey]);
     }
     $pathSegments = GeneralUtility::trimExplode('.', $typoscriptObjectPath);
     $lastSegment = array_pop($pathSegments);
     $setup = $this->typoScriptSetup;
     foreach ($pathSegments as $segment) {
         if (!array_key_exists($segment . '.', $setup)) {
             throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception('TypoScript object path "' . htmlspecialchars($typoscriptObjectPath) . '" does not exist', 1253191023);
         }
         $setup = $setup[$segment . '.'];
     }
     $content = $this->contentObjectRenderer->cObjGetSingle($setup[$lastSegment], $setup[$lastSegment . '.']);
     if (TYPO3_MODE === 'BE') {
         $this->resetFrontendEnvironment();
     }
     return $content;
 }
 /**
  * Creates an instance of tslib_cObj in $this->cObj
  * This instance is used to start the rendering of the TypoScript template structure
  *
  * @return void
  * @see pagegen.php
  * @todo Define visibility
  */
 public function newCObj()
 {
     $this->cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
     $this->cObj->start($this->page, 'pages');
 }
 /**
  * @return AbstractViewHelper
  */
 protected function createInstance()
 {
     $className = $this->getViewHelperClassName();
     /** @var AbstractViewHelper $instance */
     $instance = $this->objectManager->get($className);
     if (TRUE === method_exists($instance, 'injectConfigurationManager')) {
         $cObject = new ContentObjectRenderer();
         $cObject->start(Records::$contentRecordWithoutParentAndWithoutChildren, 'tt_content');
         /** @var ConfigurationManagerInterface $configurationManager */
         $configurationManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface');
         $configurationManager->setContentObject($cObject);
         $instance->injectConfigurationManager($configurationManager);
     }
     $instance->initialize();
     return $instance;
 }
Exemple #26
0
 /**
  * @param ProviderInterface $provider
  * @param array $row
  * @param Form $form
  * @return string|NULL
  */
 protected function renderPreviewSection(ProviderInterface $provider, array $row, Form $form = NULL)
 {
     $templatePathAndFilename = $provider->getTemplatePathAndFilename($row);
     if (NULL === $templatePathAndFilename) {
         return NULL;
     }
     $extensionKey = $provider->getExtensionKey($row);
     $paths = $provider->getTemplatePaths($row);
     $flexformVariables = $provider->getFlexFormValues($row);
     $templateVariables = $provider->getTemplateVariables($row);
     $variables = RecursiveArrayUtility::merge($templateVariables, $flexformVariables);
     $variables['row'] = $row;
     $variables['record'] = $row;
     if (TRUE === is_object($form)) {
         $formLabel = $form->getLabel();
         $label = LocalizationUtility::translate($formLabel, $extensionKey);
         $variables['label'] = $label;
     }
     $templatePaths = new TemplatePaths($paths);
     $viewContext = new ViewContext($templatePathAndFilename, $extensionKey, self::CONTROLLER_NAME);
     $viewContext->setTemplatePaths($templatePaths);
     $viewContext->setVariables($variables);
     $view = $this->configurationService->getPreparedExposedTemplateView($viewContext);
     $existingContentObject = $this->configurationManager->getContentObject();
     $contentObject = new ContentObjectRenderer();
     $contentObject->start($row, $provider->getTableName($row));
     $this->configurationManager->setContentObject($contentObject);
     $previewContent = $view->renderStandaloneSection(self::PREVIEW_SECTION, $variables, TRUE);
     $this->configurationManager->setContentObject($existingContentObject);
     $previewContent = trim($previewContent);
     return $previewContent;
 }
 /**
  * Get preview chunks - header and content - as
  * array(string $headerContent, string $previewContent, boolean $continueRendering)
  *
  * Default implementation renders the Preview section from the template
  * file that the actual Provider returns for $row, using paths also
  * determined by $row. Example: fluidcontent's Provider returns files
  * and paths based on selected "Fluid Content type" and inherits and
  * uses this method to render a Preview from the template file in the
  * specific path. This default implementation expects the TYPO3 core
  * to render the default header, so it returns NULL as $headerContent.
  *
  * @param array $row The record data to be analysed for variables to use in a rendered preview
  * @return array
  */
 public function getPreview(array $row)
 {
     $templateSource = $this->getTemplateSource($row);
     if (TRUE === empty($templateSource)) {
         return array(NULL, NULL, TRUE);
     }
     $extensionKey = $this->getExtensionKey($row);
     $flexformVariables = $this->getFlexFormValues($row);
     $templateVariables = $this->getTemplateVariables($row);
     $variables = RecursiveArrayUtility::merge($templateVariables, $flexformVariables);
     $paths = $this->getTemplatePaths($row);
     $form = $this->getForm($row);
     $formLabel = $form->getLabel();
     $label = LocalizationUtility::translate($formLabel, $extensionKey);
     $variables['label'] = $label;
     $variables['row'] = $row;
     $variables['record'] = $row;
     $view = $this->configurationService->getPreparedExposedTemplateView($extensionKey, 'Content', $paths, $variables);
     $view->setTemplateSource($templateSource);
     $existingContentObject = $this->configurationManager->getContentObject();
     $contentObject = new ContentObjectRenderer();
     $contentObject->start($row, $this->getTableName($row));
     $this->configurationManager->setContentObject($contentObject);
     $previewContent = $view->renderStandaloneSection('Preview', $variables);
     $this->configurationManager->setContentObject($existingContentObject);
     $previewContent = trim($previewContent);
     $headerContent = NULL;
     return array($headerContent, $previewContent, empty($previewContent));
 }
 /**
  * Creates an instance of ContentObjectRenderer in $this->cObj
  * This instance is used to start the rendering of the TypoScript template structure
  *
  * @return void
  * @see pagegen.php
  */
 public function newCObj()
 {
     $this->cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class);
     $this->cObj->start($this->page, 'pages');
 }
 /**
  * Initialization of the GIFBUILDER objects, in particular TEXT and IMAGE. This includes finding the bounding box, setting dimensions and offset values before the actual rendering is started.
  * Modifies the ->setup, ->objBB internal arrays
  * Should be called after the ->init() function which initializes the parent class functions/variables in general.
  * The class \TYPO3\CMS\Frontend\ContentObject\Menu\GraphicalMenuContentObject also uses gifbuilder and here there is an interesting use since the function findLargestDims() from that class calls the init() and start() functions to find the total dimensions before starting the rendering of the images.
  *
  * @param array $conf TypoScript properties for the GIFBUILDER session. Stored internally in the variable ->setup
  * @param array $data The current data record from \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer. Stored internally in the variable ->data
  * @return void
  * @see ContentObjectRenderer::getImgResource(), \TYPO3\CMS\Frontend\ContentObject\Menu\GraphicalMenuContentObject::makeGifs(), \TYPO3\CMS\Frontend\ContentObject\Menu\GraphicalMenuContentObject::findLargestDims()
  */
 public function start($conf, $data)
 {
     if (is_array($conf)) {
         $this->setup = $conf;
         $this->data = $data;
         $this->cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class);
         $this->cObj->start($this->data);
         // Hook preprocess gifbuilder conf
         // Added by Julle for 3.8.0
         //
         // Let's you pre-process the gifbuilder configuration. for
         // example you can split a string up into lines and render each
         // line as TEXT obj, see extension julle_gifbconf
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_gifbuilder.php']['gifbuilder-ConfPreProcess'])) {
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_gifbuilder.php']['gifbuilder-ConfPreProcess'] as $_funcRef) {
                 $_params = $this->setup;
                 $this->setup = GeneralUtility::callUserFunction($_funcRef, $_params, $this);
             }
         }
         // Initializing global Char Range Map
         $this->charRangeMap = array();
         if (is_array($GLOBALS['TSFE']->tmpl->setup['_GIFBUILDER.']['charRangeMap.'])) {
             foreach ($GLOBALS['TSFE']->tmpl->setup['_GIFBUILDER.']['charRangeMap.'] as $cRMcfgkey => $cRMcfg) {
                 if (is_array($cRMcfg)) {
                     // Initializing:
                     $cRMkey = $GLOBALS['TSFE']->tmpl->setup['_GIFBUILDER.']['charRangeMap.'][substr($cRMcfgkey, 0, -1)];
                     $this->charRangeMap[$cRMkey] = array();
                     $this->charRangeMap[$cRMkey]['charMapConfig'] = $cRMcfg['charMapConfig.'];
                     $this->charRangeMap[$cRMkey]['cfgKey'] = substr($cRMcfgkey, 0, -1);
                     $this->charRangeMap[$cRMkey]['multiplicator'] = (double) $cRMcfg['fontSizeMultiplicator'];
                     $this->charRangeMap[$cRMkey]['pixelSpace'] = (int) $cRMcfg['pixelSpaceFontSizeRef'];
                 }
             }
         }
         // Getting sorted list of TypoScript keys from setup.
         $sKeyArray = ArrayUtility::filterAndSortByNumericKeys($this->setup);
         // Setting the background color, passing it through stdWrap
         if ($conf['backColor.'] || $conf['backColor']) {
             $this->setup['backColor'] = isset($this->setup['backColor.']) ? trim($this->cObj->stdWrap($this->setup['backColor'], $this->setup['backColor.'])) : $this->setup['backColor'];
         }
         if (!$this->setup['backColor']) {
             $this->setup['backColor'] = 'white';
         }
         if ($conf['transparentColor.'] || $conf['transparentColor']) {
             $this->setup['transparentColor_array'] = isset($this->setup['transparentColor.']) ? explode('|', trim($this->cObj->stdWrap($this->setup['transparentColor'], $this->setup['transparentColor.']))) : explode('|', trim($this->setup['transparentColor']));
         }
         if (isset($this->setup['transparentBackground.'])) {
             $this->setup['transparentBackground'] = $this->cObj->stdWrap($this->setup['transparentBackground'], $this->setup['transparentBackground.']);
         }
         if (isset($this->setup['reduceColors.'])) {
             $this->setup['reduceColors'] = $this->cObj->stdWrap($this->setup['reduceColors'], $this->setup['reduceColors.']);
         }
         // Set default dimensions
         if (isset($this->setup['XY.'])) {
             $this->setup['XY'] = $this->cObj->stdWrap($this->setup['XY'], $this->setup['XY.']);
         }
         if (!$this->setup['XY']) {
             $this->setup['XY'] = '120,50';
         }
         // Checking TEXT and IMAGE objects for files. If any errors the objects are cleared.
         // The Bounding Box for the objects is stored in an array
         foreach ($sKeyArray as $theKey) {
             $theValue = $this->setup[$theKey];
             if ((int) $theKey && ($conf = $this->setup[$theKey . '.'])) {
                 // Swipes through TEXT and IMAGE-objects
                 switch ($theValue) {
                     case 'TEXT':
                         if ($this->setup[$theKey . '.'] = $this->checkTextObj($conf)) {
                             // Adjust font width if max size is set:
                             $maxWidth = isset($this->setup[$theKey . '.']['maxWidth.']) ? $this->cObj->stdWrap($this->setup[$theKey . '.']['maxWidth'], $this->setup[$theKey . '.']['maxWidth.']) : $this->setup[$theKey . '.']['maxWidth'];
                             if ($maxWidth) {
                                 $this->setup[$theKey . '.']['fontSize'] = $this->fontResize($this->setup[$theKey . '.']);
                             }
                             // Calculate bounding box:
                             $txtInfo = $this->calcBBox($this->setup[$theKey . '.']);
                             $this->setup[$theKey . '.']['BBOX'] = $txtInfo;
                             $this->objBB[$theKey] = $txtInfo;
                             $this->setup[$theKey . '.']['imgMap'] = 0;
                         }
                         break;
                     case 'IMAGE':
                         $fileInfo = $this->getResource($conf['file'], $conf['file.']);
                         if ($fileInfo) {
                             $this->combinedFileNames[] = preg_replace('/\\.[[:alnum:]]+$/', '', basename($fileInfo[3]));
                             if ($fileInfo['processedFile'] instanceof ProcessedFile) {
                                 // Use processed file, if a FAL file has been processed by GIFBUILDER (e.g. scaled/cropped)
                                 $this->setup[$theKey . '.']['file'] = $fileInfo['processedFile']->getForLocalProcessing(false);
                             } elseif (!isset($fileInfo['origFile']) && $fileInfo['originalFile'] instanceof File) {
                                 // Use FAL file with getForLocalProcessing to circumvent problems with umlauts, if it is a FAL file (origFile not set)
                                 /** @var $originalFile File */
                                 $originalFile = $fileInfo['originalFile'];
                                 $this->setup[$theKey . '.']['file'] = $originalFile->getForLocalProcessing(false);
                             } else {
                                 // Use normal path from fileInfo if it is a non-FAL file (even non-FAL files have originalFile set, but only non-FAL files have origFile set)
                                 $this->setup[$theKey . '.']['file'] = $fileInfo[3];
                             }
                             $this->setup[$theKey . '.']['BBOX'] = $fileInfo;
                             $this->objBB[$theKey] = $fileInfo;
                             if ($conf['mask']) {
                                 $maskInfo = $this->getResource($conf['mask'], $conf['mask.']);
                                 if ($maskInfo) {
                                     // the same selection criteria as regarding fileInfo above apply here
                                     if ($maskInfo['processedFile'] instanceof ProcessedFile) {
                                         $this->setup[$theKey . '.']['mask'] = $maskInfo['processedFile']->getForLocalProcessing(false);
                                     } elseif (!isset($maskInfo['origFile']) && $maskInfo['originalFile'] instanceof File) {
                                         /** @var $originalFile File */
                                         $originalFile = $maskInfo['originalFile'];
                                         $this->setup[$theKey . '.']['mask'] = $originalFile->getForLocalProcessing(false);
                                     } else {
                                         $this->setup[$theKey . '.']['mask'] = $maskInfo[3];
                                     }
                                 } else {
                                     $this->setup[$theKey . '.']['mask'] = '';
                                 }
                             }
                         } else {
                             unset($this->setup[$theKey . '.']);
                         }
                         break;
                 }
                 // Checks if disabled is set... (this is also done in menu.php / imgmenu!!)
                 if ($conf['if.']) {
                     $cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class);
                     $cObj->start($this->data);
                     if (!$cObj->checkIf($conf['if.'])) {
                         unset($this->setup[$theKey]);
                         unset($this->setup[$theKey . '.']);
                         unset($this->objBB[$theKey]);
                     }
                 }
             }
         }
         // Calculate offsets on elements
         $this->setup['XY'] = $this->calcOffset($this->setup['XY']);
         if (isset($this->setup['offset.'])) {
             $this->setup['offset'] = $this->cObj->stdWrap($this->setup['offset'], $this->setup['offset.']);
         }
         $this->setup['offset'] = $this->calcOffset($this->setup['offset']);
         if (isset($this->setup['workArea.'])) {
             $this->setup['workArea'] = $this->cObj->stdWrap($this->setup['workArea'], $this->setup['workArea.']);
         }
         $this->setup['workArea'] = $this->calcOffset($this->setup['workArea']);
         foreach ($sKeyArray as $theKey) {
             $theValue = $this->setup[$theKey];
             if ((int) $theKey && ($conf = $this->setup[$theKey . '.'])) {
                 switch ($theValue) {
                     case 'TEXT':
                     case 'IMAGE':
                         if (isset($this->setup[$theKey . '.']['offset.'])) {
                             $this->setup[$theKey . '.']['offset'] = $this->cObj->stdWrap($this->setup[$theKey . '.']['offset'], $this->setup[$theKey . '.']['offset.']);
                             unset($this->setup[$theKey . '.']['offset.']);
                         }
                         if ($this->setup[$theKey . '.']['offset']) {
                             $this->setup[$theKey . '.']['offset'] = $this->calcOffset($this->setup[$theKey . '.']['offset']);
                         }
                         break;
                     case 'BOX':
                     case 'ELLIPSE':
                         if (isset($this->setup[$theKey . '.']['dimensions.'])) {
                             $this->setup[$theKey . '.']['dimensions'] = $this->cObj->stdWrap($this->setup[$theKey . '.']['dimensions'], $this->setup[$theKey . '.']['dimensions.']);
                             unset($this->setup[$theKey . '.']['dimensions.']);
                         }
                         if ($this->setup[$theKey . '.']['dimensions']) {
                             $this->setup[$theKey . '.']['dimensions'] = $this->calcOffset($this->setup[$theKey . '.']['dimensions']);
                         }
                         break;
                     case 'WORKAREA':
                         if (isset($this->setup[$theKey . '.']['set.'])) {
                             $this->setup[$theKey . '.']['set'] = $this->cObj->stdWrap($this->setup[$theKey . '.']['set'], $this->setup[$theKey . '.']['set.']);
                             unset($this->setup[$theKey . '.']['set.']);
                         }
                         if ($this->setup[$theKey . '.']['set']) {
                             $this->setup[$theKey . '.']['set'] = $this->calcOffset($this->setup[$theKey . '.']['set']);
                         }
                         break;
                     case 'CROP':
                         if (isset($this->setup[$theKey . '.']['crop.'])) {
                             $this->setup[$theKey . '.']['crop'] = $this->cObj->stdWrap($this->setup[$theKey . '.']['crop'], $this->setup[$theKey . '.']['crop.']);
                             unset($this->setup[$theKey . '.']['crop.']);
                         }
                         if ($this->setup[$theKey . '.']['crop']) {
                             $this->setup[$theKey . '.']['crop'] = $this->calcOffset($this->setup[$theKey . '.']['crop']);
                         }
                         break;
                     case 'SCALE':
                         if (isset($this->setup[$theKey . '.']['width.'])) {
                             $this->setup[$theKey . '.']['width'] = $this->cObj->stdWrap($this->setup[$theKey . '.']['width'], $this->setup[$theKey . '.']['width.']);
                             unset($this->setup[$theKey . '.']['width.']);
                         }
                         if ($this->setup[$theKey . '.']['width']) {
                             $this->setup[$theKey . '.']['width'] = $this->calcOffset($this->setup[$theKey . '.']['width']);
                         }
                         if (isset($this->setup[$theKey . '.']['height.'])) {
                             $this->setup[$theKey . '.']['height'] = $this->cObj->stdWrap($this->setup[$theKey . '.']['height'], $this->setup[$theKey . '.']['height.']);
                             unset($this->setup[$theKey . '.']['height.']);
                         }
                         if ($this->setup[$theKey . '.']['height']) {
                             $this->setup[$theKey . '.']['height'] = $this->calcOffset($this->setup[$theKey . '.']['height']);
                         }
                         break;
                 }
             }
         }
         // Get trivial data
         $XY = GeneralUtility::intExplode(',', $this->setup['XY']);
         $maxWidth = isset($this->setup['maxWidth.']) ? (int) $this->cObj->stdWrap($this->setup['maxWidth'], $this->setup['maxWidth.']) : (int) $this->setup['maxWidth'];
         $maxHeight = isset($this->setup['maxHeight.']) ? (int) $this->cObj->stdWrap($this->setup['maxHeight'], $this->setup['maxHeight.']) : (int) $this->setup['maxHeight'];
         $XY[0] = MathUtility::forceIntegerInRange($XY[0], 1, $maxWidth ?: 2000);
         $XY[1] = MathUtility::forceIntegerInRange($XY[1], 1, $maxHeight ?: 2000);
         $this->XY = $XY;
         $this->w = $XY[0];
         $this->h = $XY[1];
         $this->OFFSET = GeneralUtility::intExplode(',', $this->setup['offset']);
         // this sets the workArea
         $this->setWorkArea($this->setup['workArea']);
         // this sets the default to the current;
         $this->defaultWorkArea = $this->workArea;
     }
 }
Exemple #30
0
 /**
  * Returns the Backend User edit panel for the $row from $tablename
  *
  * @param array $row Record array.
  * @param string $tablename Table name
  * @param string $label A label to show with the panel.
  * @param array $conf TypoScript parameters to pass along to the EDITPANEL content Object that gets rendered. The property "allow" WILL get overridden/set though.
  * @return string Returns FALSE/blank if no BE User login and of course if the panel is not shown for other reasons. Otherwise the HTML for the panel (a table).
  * @see ContentObjectRenderer::EDITPANEL()
  */
 public function pi_getEditPanel($row = array(), $tablename = '', $label = '', $conf = array())
 {
     $panel = '';
     if (!$row || !$tablename) {
         $row = $this->internal['currentRow'];
         $tablename = $this->internal['currentTable'];
     }
     if ($this->frontendController->beUserLogin) {
         // Create local cObj if not set:
         if (!is_object($this->pi_EPtemp_cObj)) {
             $this->pi_EPtemp_cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class);
             $this->pi_EPtemp_cObj->setParent($this->cObj->data, $this->cObj->currentRecord);
         }
         // Initialize the cObj object with current row
         $this->pi_EPtemp_cObj->start($row, $tablename);
         // Setting TypoScript values in the $conf array. See documentation in TSref for the EDITPANEL cObject.
         $conf['allow'] = 'edit,new,delete,move,hide';
         $panel = $this->pi_EPtemp_cObj->cObjGetSingle('EDITPANEL', $conf, 'editpanel');
     }
     if ($panel) {
         if ($label) {
             return '<!-- BEGIN: EDIT PANEL --><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td valign="top">' . $label . '</td><td valign="top" align="right">' . $panel . '</td></tr></table><!-- END: EDIT PANEL -->';
         } else {
             return '<!-- BEGIN: EDIT PANEL -->' . $panel . '<!-- END: EDIT PANEL -->';
         }
     } else {
         return $label;
     }
 }