/** * @param array $array */ public static function viewArray($array) { if (class_exists('t3lib_utility_Debug') && is_callable('t3lib_utility_Debug::viewArray')) { t3lib_utility_Debug::viewArray($array); } else { t3lib_div::view_array($array); } }
/** * Returns the internal debug messages as a string. * * @return string */ public function toString() { $messagesAsString = ''; if (count($this->debugMessages)) { $messagesAsString = t3lib_utility_Debug::viewArray($this->debugMessages); } return $messagesAsString; }
/** * Returns HTML-code, which is a visual representation of a multidimensional array * use t3lib_div::print_array() in order to print an array * Returns false if $array_in is not an array * * @param mixed Array to view * @return string HTML output */ public static function viewArray($array_in) { if (tx_rnbase_util_TYPO3::isTYPO62OrHigher()) { return \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($array_in); } else { return t3lib_utility_Debug::viewArray($array_in); } }
public function outputDebugLog() { $out = ''; foreach ($this->debugLog as $section => $logData) { $out .= Tx_Formhandler_Globals::$cObj->wrap($section, $this->settings['sectionHeaderWrap']); $sectionContent = ''; foreach ($logData as $messageData) { $message = str_replace("\n", '<br />', $messageData['message']); $message = Tx_Formhandler_Globals::$cObj->wrap($message, $this->settings['severityWrap.'][$messageData['severity']]); $sectionContent .= Tx_Formhandler_Globals::$cObj->wrap($message, $this->settings['messageWrap']); if ($messageData['data']) { if (t3lib_div::int_from_ver(TYPO3_branch) < t3lib_div::int_from_ver('4.5')) { $sectionContent .= t3lib_div::view_array($messageData['data']); } else { $sectionContent .= t3lib_utility_Debug::viewArray($messageData['data']); } $sectionContent .= '<br />'; } } $out .= Tx_Formhandler_Globals::$cObj->wrap($sectionContent, $this->settings['sectionWrap']); } print $out; }
/** * Function to read values from session * * @param string $content Given content (normally empty) * @param array $conf TypoScript configuration for this userFunc * @return string Session values */ public function readSession($content = '', $conf = array()) { $info = $GLOBALS['TSFE']->fe_user->getKey('ses', $this->sessionPrefix); $string = 'Powermail Marketing:<br />'; if (is_array($info)) { $string .= t3lib_utility_Debug::viewArray($info); } else { $string .= 'Empty Session!'; } return $string; }
/** * Shows the log of indexed URLs * * @return string HTML output */ function drawLog() { global $BACK_PATH; $output = ''; // Init: $this->crawlerObj = t3lib_div::makeInstance('tx_crawler_lib'); $this->crawlerObj->setAccessMode('gui'); $this->crawlerObj->setID = t3lib_div::md5int(microtime()); $this->CSVExport = t3lib_div::_POST('_csv'); // Read URL: if (t3lib_div::_GP('qid_read')) { $this->crawlerObj->readUrl(intval(t3lib_div::_GP('qid_read')), TRUE); } // Look for set ID sent - if it is, we will display contents of that set: $showSetId = intval(t3lib_div::_GP('setID')); // Show details: if (t3lib_div::_GP('qid_details')) { // Get entry record: list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tx_crawler_queue', 'qid=' . intval(t3lib_div::_GP('qid_details'))); // Explode values: $resStatus = $this->getResStatus($q_entry); $q_entry['parameters'] = unserialize($q_entry['parameters']); $q_entry['result_data'] = unserialize($q_entry['result_data']); if (is_array($q_entry['result_data'])) { $q_entry['result_data']['content'] = unserialize($q_entry['result_data']['content']); } if (!$this->pObj->MOD_SETTINGS['log_resultLog']) { unset($q_entry['result_data']['content']['log']); } // Print rudimentary details: $output .= ' <br /><br /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.back') . '" name="_back" /> <input type="hidden" value="' . $this->pObj->id . '" name="id" /> <input type="hidden" value="' . $showSetId . '" name="setID" /> <br /> Current server time: ' . date('H:i:s', time()) . '<br />' . 'Status: ' . $resStatus . '<br />' . (version_compare(TYPO3_version, '4.5.0', '<') ? t3lib_div::view_array($q_entry) : t3lib_utility_Debug::viewArray($q_entry)); } else { // Show list: // If either id or set id, show list: if ($this->pObj->id || $showSetId) { if ($this->pObj->id) { // Drawing tree: $tree = t3lib_div::makeInstance('t3lib_pageTree'); $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); $tree->init('AND ' . $perms_clause); // Set root row: $HTML = t3lib_iconWorks::getSpriteIconForRecord('pages', $this->pObj->pageinfo); $HTML = t3lib_iconWorks::getSpriteIconForRecord('pages', $this->pObj->pageinfo); $tree->tree[] = array('row' => $this->pObj->pageinfo, 'HTML' => $HTML); // Get branch beneath: if ($this->pObj->MOD_SETTINGS['depth']) { $tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], ''); } // Traverse page tree: $code = ''; $count = 0; foreach ($tree->tree as $data) { $code .= $this->drawLog_addRows($data['row'], $data['HTML'] . t3lib_BEfunc::getRecordTitle('pages', $data['row'], TRUE), intval($this->pObj->MOD_SETTINGS['itemsPerPage'])); if (++$count == 1000) { break; } } } else { $code = ''; $code .= $this->drawLog_addRows($showSetId, 'Set ID: ' . $showSetId); } if ($code) { $output .= ' <br /><br /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.reloadlist') . '" name="_reload" /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.downloadcsv') . '" name="_csv" /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.flushvisiblequeue') . '" name="_flush" onclick="return confirm(\'' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.confirmyouresure') . '\');" /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.flushfullqueue') . '" name="_flush_all" onclick="return confirm(\'' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.confirmyouresure') . '\');" /> <input type="hidden" value="' . $this->pObj->id . '" name="id" /> <input type="hidden" value="' . $showSetId . '" name="setID" /> <br /> ' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime') . ': ' . date('H:i:s', time()) . ' <br /><br /> <table class="lrPadding c-list crawlerlog">' . $this->drawLog_printTableHeader() . $code . '</table>'; } } else { // Otherwise show available sets: $setList = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('set_id, count(*) as count_value, scheduled', 'tx_crawler_queue', '', 'set_id, scheduled', 'scheduled DESC'); $code = ' <tr class="bgColor5 tableheader"> <td>' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.setid') . ':</td> <td>' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count') . 't:</td> <td>' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time') . ':</td> </tr> '; $cc = 0; foreach ($setList as $set) { $code .= ' <tr class="bgColor' . ($cc % 2 ? '-20' : '-10') . '"> <td><a href="' . htmlspecialchars('index.php?setID=' . $set['set_id']) . '">' . $set['set_id'] . '</a></td> <td>' . $set['count_value'] . '</td> <td>' . t3lib_BEfunc::dateTimeAge($set['scheduled']) . '</td> </tr> '; $cc++; } $output .= ' <br /><br /> <table class="lrPadding c-list">' . $code . '</table>'; } } if ($this->CSVExport) { $this->outputCsvFile(); } // Return output return $output; }
/** * Returns a table with the error-messages. * * @return string HTML print of error log */ function printErrorLog() { return count($this->errorLog) ? t3lib_utility_Debug::viewArray($this->errorLog) : ''; }
/** * Show meta data part of Data Structure * * @param [type] $DSstring: ... * @return [type] ... */ function DSdetails($DSstring) { $DScontent = t3lib_div::xml2array($DSstring); $inputFields = 0; $referenceFields = 0; $rootelements = 0; if (is_array ($DScontent) && is_array($DScontent['ROOT']['el'])) { foreach($DScontent['ROOT']['el'] as $elKey => $elCfg) { $rootelements++; if (isset($elCfg['TCEforms'])) { // Assuming that a reference field for content elements is recognized like this, increment counter. Otherwise assume input field of some sort. if ($elCfg['TCEforms']['config']['type']==='group' && $elCfg['TCEforms']['config']['allowed']==='tt_content') { $referenceFields++; } else { $inputFields++; } } if (isset($elCfg['el'])) $elCfg['el'] = '...'; unset($elCfg['tx_templavoila']['sample_data']); unset($elCfg['tx_templavoila']['tags']); unset($elCfg['tx_templavoila']['eType']); if (tx_templavoila_div::convertVersionNumberToInteger(TYPO3_version) < 4005000){ $rootElementsHTML.='<b>'.$elCfg['tx_templavoila']['title'].'</b>'.t3lib_div::view_array($elCfg); } else { $rootElementsHTML.='<b>'.$elCfg['tx_templavoila']['title'].'</b>'.t3lib_utility_Debug::viewArray($elCfg); } } } /* $DScontent = array('meta' => $DScontent['meta']); */ $languageMode = ''; if (is_array($DScontent['meta'])) { if ($DScontent['meta']['langDisable']) { $languageMode = 'Disabled'; } elseif ($DScontent['meta']['langChildren']) { $languageMode = 'Inheritance'; } else { $languageMode = 'Separate'; } } return array( 'HTML' => /*t3lib_div::view_array($DScontent).'Language Mode => "'.$languageMode.'"<hr/> Root Elements = '.$rootelements.', hereof ref/input fields = '.($referenceFields.'/'.$inputFields).'<hr/> '.$rootElementsHTML*/ $this->renderDSdetails($DScontent), 'languageMode' => $languageMode, 'rootelements' => $rootelements, 'inputFields' => $inputFields, 'referenceFields' => $referenceFields ); }
/** * Find the best service and check if it works. * Returns object of the service class. * * @param string $serviceType Type of service (service key). * @param string $serviceSubType Sub type like file extensions or similar. Defined by the service. * @param mixed $excludeServiceKeys List of service keys which should be excluded in the search for a service. Array or comma list. * @return object The service object or an array with error info's. */ public static function makeInstanceService($serviceType, $serviceSubType = '', $excludeServiceKeys = array()) { $error = FALSE; if (!is_array($excludeServiceKeys)) { $excludeServiceKeys = self::trimExplode(',', $excludeServiceKeys, 1); } $requestInfo = array('requestedServiceType' => $serviceType, 'requestedServiceSubType' => $serviceSubType, 'requestedExcludeServiceKeys' => $excludeServiceKeys); while ($info = t3lib_extMgm::findService($serviceType, $serviceSubType, $excludeServiceKeys)) { // provide information about requested service to service object $info = array_merge($info, $requestInfo); // Check persistent object and if found, call directly and exit. if (is_object($GLOBALS['T3_VAR']['makeInstanceService'][$info['className']])) { // update request info in persistent object $GLOBALS['T3_VAR']['makeInstanceService'][$info['className']]->info = $info; // reset service and return object $GLOBALS['T3_VAR']['makeInstanceService'][$info['className']]->reset(); return $GLOBALS['T3_VAR']['makeInstanceService'][$info['className']]; // include file and create object } else { $requireFile = self::getFileAbsFileName($info['classFile']); if (@is_file($requireFile)) { self::requireOnce($requireFile); $obj = self::makeInstance($info['className']); if (is_object($obj)) { if (!@is_callable(array($obj, 'init'))) { // use silent logging??? I don't think so. die('Broken service:' . t3lib_utility_Debug::viewArray($info)); } $obj->info = $info; if ($obj->init()) { // service available? // create persistent object $GLOBALS['T3_VAR']['makeInstanceService'][$info['className']] = $obj; // needed to delete temp files register_shutdown_function(array(&$obj, '__destruct')); return $obj; // object is passed as reference by function definition } $error = $obj->getLastErrorArray(); unset($obj); } } } // deactivate the service t3lib_extMgm::deactivateService($info['serviceType'], $info['serviceKey']); } return $error; }
/** * Create the rows for display of the page tree * For each page a number of rows are shown displaying GET variable configuration * * @param array Page row * @param string Page icon and title for row * @return string HTML <tr> content (one or more) */ public function drawURLs_addRowsForPage(array $pageRow, $pageTitleAndIcon) { $skipMessage = ''; // Get list of configurations $configurations = $this->getUrlsForPageRow($pageRow, $skipMessage); if (count($this->incomingConfigurationSelection) > 0) { // remove configuration that does not match the current selection foreach ($configurations as $confKey => $confArray) { if (!in_array($confKey, $this->incomingConfigurationSelection)) { unset($configurations[$confKey]); } } } // Traverse parameter combinations: $c = 0; $cc = 0; $content = ''; if (count($configurations)) { foreach ($configurations as $confKey => $confArray) { // Title column: if (!$c) { $titleClm = '<td rowspan="' . count($configurations) . '">' . $pageTitleAndIcon . '</td>'; } else { $titleClm = ''; } if (!in_array($pageRow['uid'], $this->expandExcludeString($confArray['subCfg']['exclude']))) { // URL list: $urlList = $this->urlListFromUrlArray($confArray, $pageRow, $this->scheduledTime, $this->reqMinute, $this->submitCrawlUrls, $this->downloadCrawlUrls, $this->duplicateTrack, $this->downloadUrls, $this->incomingProcInstructions); // Expanded parameters: $paramExpanded = ''; $calcAccu = array(); $calcRes = 1; foreach ($confArray['paramExpanded'] as $gVar => $gVal) { $paramExpanded .= ' <tr> <td class="bgColor4-20">' . htmlspecialchars('&' . $gVar . '=') . '<br/>' . '(' . count($gVal) . ')' . '</td> <td class="bgColor4" nowrap="nowrap">' . nl2br(htmlspecialchars(implode(chr(10), $gVal))) . '</td> </tr> '; $calcRes *= count($gVal); $calcAccu[] = count($gVal); } $paramExpanded = '<table class="lrPadding c-list param-expanded">' . $paramExpanded . '</table>'; $paramExpanded .= 'Comb: ' . implode('*', $calcAccu) . '=' . $calcRes; // Options $optionValues = ''; if ($confArray['subCfg']['userGroups']) { $optionValues .= 'User Groups: ' . $confArray['subCfg']['userGroups'] . '<br/>'; } if ($confArray['subCfg']['baseUrl']) { $optionValues .= 'Base Url: ' . $confArray['subCfg']['baseUrl'] . '<br/>'; } if ($confArray['subCfg']['procInstrFilter']) { $optionValues .= 'ProcInstr: ' . $confArray['subCfg']['procInstrFilter'] . '<br/>'; } // Compile row: $content .= ' <tr class="bgColor' . ($c % 2 ? '-20' : '-10') . '"> ' . $titleClm . ' <td>' . htmlspecialchars($confKey) . '</td> <td>' . nl2br(htmlspecialchars(rawurldecode(trim(str_replace('&', chr(10) . '&', t3lib_div::implodeArrayForUrl('', $confArray['paramParsed'])))))) . '</td> <td>' . $paramExpanded . '</td> <td nowrap="nowrap">' . $urlList . '</td> <td nowrap="nowrap">' . $optionValues . '</td> <td nowrap="nowrap">' . (version_compare(TYPO3_version, '4.5.0', '<') ? t3lib_div::view_array($confArray['subCfg']['procInstrParams.']) : t3lib_utility_Debug::viewArray($confArray['subCfg']['procInstrParams.'])) . '</td> </tr>'; } else { $content .= '<tr class="bgColor' . ($c % 2 ? '-20' : '-10') . '"> ' . $titleClm . ' <td>' . htmlspecialchars($confKey) . '</td> <td colspan="5"><em>No entries</em> (Page is excluded in this configuration)</td> </tr>'; } $c++; } } else { $message = !empty($skipMessage) ? ' (' . $skipMessage . ')' : ''; // Compile row: $content .= ' <tr class="bgColor-20" style="border-bottom: 1px solid black;"> <td>' . $pageTitleAndIcon . '</td> <td colspan="6"><em>No entries</em>' . $message . '</td> </tr>'; } return $content; }
/** * Save mail on submit * * @param array $field Field values * @param int $form Form uid * @return Tx_Powermail_Domain_Model_Mails Mail object */ protected function saveMail($field, $form) { // tx_powermail_domain_model_mails $marketingInfos = Tx_Powermail_Utility_Div::getMarketingInfos(); $newMail = t3lib_div::makeInstance('Tx_Powermail_Domain_Model_Mails'); $newMail->setPid(Tx_Powermail_Utility_Div::getStoragePage($this->settings['main']['pid'])); $newMail->setForm($form); $newMail->setSenderMail($this->div->getSenderMailFromArguments($field)); $newMail->setSenderName($this->div->getSenderNameFromArguments($field)); $newMail->setSubject($this->settings['receiver']['subject']); $newMail->setBody(t3lib_utility_Debug::viewArray($this->div->getVariablesWithLabels($field))); $newMail->setReceiverMail($this->settings['receiver']['email']); if (intval($GLOBALS['TSFE']->fe_user->user['uid']) > 0) { $newMail->setFeuser($GLOBALS['TSFE']->fe_user->user['uid']); } $newMail->setSpamFactor($GLOBALS['TSFE']->fe_user->getKey('ses', 'powermail_spamfactor')); $newMail->setTime((time() - Tx_Powermail_Utility_Div::getFormStartFromSession($form))); if (isset($this->settings['global']['disableIpLog']) && $this->settings['global']['disableIpLog'] == 0) { $newMail->setSenderIp(t3lib_div::getIndpEnv('REMOTE_ADDR')); } $newMail->setUserAgent(t3lib_div::getIndpEnv('HTTP_USER_AGENT')); $newMail->setMarketingSearchterm($marketingInfos['marketingSearchterm']); $newMail->setMarketingReferer($marketingInfos['marketingReferer']); $newMail->setMarketingPayedSearchResult($marketingInfos['marketingPayedSearchResult']); $newMail->setMarketingLanguage($marketingInfos['marketingLanguage']); $newMail->setMarketingBrowserLanguage($marketingInfos['marketingBrowserLanguage']); $newMail->setMarketingFunnel($marketingInfos['marketingFunnel']); if ($this->settings['main']['optin'] || $this->settings['db']['hidden']) { $newMail->setHidden(1); } $this->mailsRepository->add($newMail); $persistenceManager = t3lib_div::makeInstance('Tx_Extbase_Persistence_Manager'); $persistenceManager->persistAll(); // tx_powermail_domain_model_answers foreach ((array) $field as $uid => $value) { // one loop for every received field if (!is_numeric($uid)) { continue; } $newAnswer = t3lib_div::makeInstance('Tx_Powermail_Domain_Model_Answers'); $newAnswer->setPid(Tx_Powermail_Utility_Div::getStoragePage($this->settings['main']['pid'])); $newAnswer->setValue($value); $newAnswer->setField($uid); $newAnswer->setMail($newMail->getUid()); $this->answersRepository->add($newAnswer); } return $newMail; }
function quickDBlookUp() { $output = 'Enter [table]:[uid]:[fieldlist (optional)] <input name="table_uid" value="' . htmlspecialchars(t3lib_div::_POST('table_uid')) . '" />'; $output .= '<input type="submit" name="_" value="REFRESH" /><br />'; // Show record: if (t3lib_div::_POST('table_uid')) { list($table, $uid, $fieldName) = t3lib_div::trimExplode(':', t3lib_div::_POST('table_uid'), 1); if ($GLOBALS['TCA'][$table]) { $rec = t3lib_BEfunc::getRecordRaw($table, 'uid=' . intval($uid), $fieldName ? $fieldName : '*'); if (count($rec)) { if (t3lib_div::_POST('_EDIT')) { $output .= '<hr />Edit:<br /><br />'; foreach ($rec as $field => $value) { $output .= htmlspecialchars($field) . '<br /><input name="record[' . $table . '][' . $uid . '][' . $field . ']" value="' . htmlspecialchars($value) . '" /><br />'; } $output .= '<input type="submit" name="_SAVE" value="SAVE" />'; } elseif (t3lib_div::_POST('_SAVE')) { $incomingData = t3lib_div::_POST('record'); $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . intval($uid), $incomingData[$table][$uid]); $output .= '<br />Updated ' . $table . ':' . $uid . '...'; $this->updateRefIndex($table, $uid); } else { if (t3lib_div::_POST('_DELETE')) { $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, 'uid=' . intval($uid)); $output .= '<br />Deleted ' . $table . ':' . $uid . '...'; $this->updateRefIndex($table, $uid); } else { $output .= '<input type="submit" name="_EDIT" value="EDIT" />'; $output .= '<input type="submit" name="_DELETE" value="DELETE" onclick="return confirm(\'Are you sure you wish to delete?\');" />'; $output .= t3lib_utility_Debug::viewArray($rec); $output .= md5(implode($rec)); } } } else { $output .= 'No record existed!'; } } } return $output; }
/** * Print TypoScript parsing log * * @return string HTML table with the information about parsing times. * @see t3lib_tsfeBeUserAuth::extGetCategory_tsdebug() */ public function printTSlog() { // Calculate times and keys for the tsStackLog foreach ($this->tsStackLog as $uniqueId => &$data) { $data['endtime'] = $this->getDifferenceToStarttime($data['endtime']); $data['starttime'] = $this->getDifferenceToStarttime($data['starttime']); $data['deltatime'] = $data['endtime'] - $data['starttime']; if (is_array($data['tsStack'])) { $data['key'] = implode($data['stackPointer'] ? '.' : '/', end($data['tsStack'])); } } // Create hierarchical array of keys pointing to the stack $arr = array(); foreach ($this->tsStackLog as $uniqueId => $data) { $this->createHierarchyArray($arr, $data['level'], $uniqueId); } // Parsing the registeret content and create icon-html for the tree $this->tsStackLog[$arr['0.'][0]]['content'] = $this->fixContent($arr['0.']['0.'], $this->tsStackLog[$arr['0.'][0]]['content'], '', 0, $arr['0.'][0]); // Displaying the tree: $outputArr = array(); $outputArr[] = $this->fw('TypoScript Key'); $outputArr[] = $this->fw('Value'); if ($this->printConf['allTime']) { $outputArr[] = $this->fw('Time'); $outputArr[] = $this->fw('Own'); $outputArr[] = $this->fw('Sub'); $outputArr[] = $this->fw('Total'); } else { $outputArr[] = $this->fw('Own'); } $outputArr[] = $this->fw('Details'); $out = ''; foreach ($outputArr as $row) { $out .= ' <th><strong>' . $row . '</strong></th>'; } $out = '<tr>' . $out . '</tr>'; $flag_tree = $this->printConf['flag_tree']; $flag_messages = $this->printConf['flag_messages']; $flag_content = $this->printConf['flag_content']; $flag_queries = $this->printConf['flag_queries']; $keyLgd = $this->printConf['keyLgd']; $factor = $this->printConf['factor']; $col = $this->printConf['col']; $highlight_col = $this->printConf['highlight_col']; $c = 0; foreach ($this->tsStackLog as $uniqueId => $data) { if ($this->highlightLongerThan && intval($data['owntime']) > intval($this->highlightLongerThan)) { $logRowClass = 'typo3-adminPanel-logRow-highlight'; } else { $logRowClass = $c % 2 ? 'typo3-adminPanel-logRow-odd' : 'typo3-adminPanel-logRow-even'; } $item = ''; if (!$c) { // If first... $data['icons'] = ''; $data['key'] = 'Script Start'; $data['value'] = ''; } // key label: $keyLabel = ''; if (!$flag_tree && $data['stackPointer']) { $temp = array(); foreach ($data['tsStack'] as $k => $v) { $temp[] = t3lib_div::fixed_lgd_cs(implode($v, $k ? '.' : '/'), -$keyLgd); } array_pop($temp); $temp = array_reverse($temp); array_pop($temp); if (count($temp)) { $keyLabel = '<br /><span style="color:#999999;">' . implode($temp, '<br />') . '</span>'; } } if ($flag_tree) { $tmp = t3lib_div::trimExplode('.', $data['key'], 1); $theLabel = end($tmp); } else { $theLabel = $data['key']; } $theLabel = t3lib_div::fixed_lgd_cs($theLabel, -$keyLgd); $theLabel = $data['stackPointer'] ? '<span class="stackPointer">' . $theLabel . '</span>' : $theLabel; $keyLabel = $theLabel . $keyLabel; $item .= '<td class="' . $logRowClass . '" style="padding-left:2px;">' . ($flag_tree ? $data['icons'] : '') . $this->fw($keyLabel) . '</td>'; // key value: $keyValue = $data['value']; $item .= '<td class="' . $logRowClass . ' typo3-adminPanel-tsLogTime" style="' . $bgColor . '">' . $this->fw(htmlspecialchars($keyValue)) . '</td>'; if ($this->printConf['allTime']) { $item .= '<td class="' . $logRowClass . ' typo3-adminPanel-tsLogTime"> ' . $this->fw($data['starttime']) . '</td>'; $item .= '<td class="' . $logRowClass . ' typo3-adminPanel-tsLogTime"> ' . $this->fw($data['owntime']) . '</td>'; $item .= '<td class="' . $logRowClass . ' typo3-adminPanel-tsLogTime"> ' . $this->fw($data['subtime'] ? '+' . $data['subtime'] : '') . '</td>'; $item .= '<td class="' . $logRowClass . ' typo3-adminPanel-tsLogTime"> ' . $this->fw($data['subtime'] ? '=' . $data['deltatime'] : '') . '</td>'; } else { $item .= '<td class="' . $logRowClass . ' typo3-adminPanel-tsLogTime"> ' . $this->fw($data['owntime']) . '</td>'; } // messages: $msgArr = array(); $msg = ''; if ($flag_messages && is_array($data['message'])) { foreach ($data['message'] as $v) { $msgArr[] = nl2br($v); } } if ($flag_queries && is_array($data['selectQuery'])) { $msgArr[] = t3lib_utility_Debug::viewArray($data['selectQuery']); } if ($flag_content && strcmp($data['content'], '')) { $maxlen = 120; if (preg_match_all('/(\\S{' . $maxlen . ',})/', $data['content'], $reg)) { // Break lines which are too longer than $maxlen chars (can happen if content contains long paths...) foreach ($reg[1] as $key => $match) { $match = preg_replace('/(.{' . $maxlen . '})/', '$1 ', $match); $data['content'] = str_replace($reg[0][$key], $match, $data['content']); } } $msgArr[] = '<span style="color:#000066;">' . nl2br($data['content']) . '</span>'; } if (count($msgArr)) { $msg = implode($msgArr, '<hr />'); } $item .= '<td valign="top" class="' . $logRowClass . '" style="text-align:left;">' . $this->fw($msg) . '</td>'; $out .= '<tr>' . $item . '</tr>'; $c++; } $out = '<table id="typo3-adminPanel-tsLog">' . $out . '</table>'; return $out; }
/** * [Describe function...] * * @param [type] $table: ... * @param [type] $uid: ... * @return [type] ... */ function moduleContent($table, $uid, $cmd) { if ($GLOBALS['TCA'][$table]) { $output = ''; $this->l10nMgrTools = t3lib_div::makeInstance('tx_l10nmgr_tools'); $this->l10nMgrTools->verbose = FALSE; // Otherwise it will show records which has fields but none editable. switch ((string) $cmd) { case 'updateIndex': $output = $this->l10nMgrTools->updateIndexForRecord($table, $uid); t3lib_BEfunc::setUpdateSignal('updatePageTree'); break; case 'flushTranslations': if ($GLOBALS['BE_USER']->isAdmin()) { $res = $this->l10nMgrTools->flushTranslations($table, $uid, t3lib_div::_POST('_flush') ? TRUE : FALSE); if (!t3lib_div::_POST('_flush')) { $output .= 'To flush the translations shown below, press the "Flush" button below:<br/><input type="submit" name="_flush" value="FLUSH" /><br/><br/>'; } else { $output .= 'Translations below were flushed!'; } $output .= t3lib_utility_Debug::viewArray($res[0]); if (t3lib_div::_POST('_flush')) { $output .= $this->l10nMgrTools->updateIndexForRecord($table, $uid); t3lib_BEfunc::setUpdateSignal('updatePageTree'); } } break; case 'createPriority': header('Location: ' . t3lib_div::locationHeaderUrl($GLOBALS['BACK_PATH'] . 'alt_doc.php?returnUrl=' . rawurlencode('db_list.php?id=0&table=tx_l10nmgr_priorities') . '&edit[tx_l10nmgr_priorities][0]=new&defVals[tx_l10nmgr_priorities][element]=' . rawurlencode($table . '_' . $uid))); break; case 'managePriorities': header('Location: ' . t3lib_div::locationHeaderUrl($GLOBALS['BACK_PATH'] . 'db_list.php?id=0&table=tx_l10nmgr_priorities')); break; } return $output; } }
/** * Implements the TypoScript data type "getText". This takes a string with parameters and based on those a value from somewhere in the system is returned. * * @param string The parameter string, eg. "field : title" or "field : navtitle // field : title" (in the latter case and example of how the value is FIRST splitted by "//" is shown) * @param mixed Alternative field array; If you set this to an array this variable will be used to look up values for the "field" key. Otherwise the current page record in $GLOBALS['TSFE']->page is used. * @return string The value fetched * @see getFieldVal() */ function getData($string, $fieldArray) { global $TYPO3_CONF_VARS; if (!is_array($fieldArray)) { $fieldArray = $GLOBALS['TSFE']->page; } $retVal = ''; $sections = explode('//', $string); while (!$retVal and list($secKey, $secVal) = each($sections)) { $parts = explode(':', $secVal, 2); $key = trim($parts[1]); if ((string) $key != '') { $type = strtolower(trim($parts[0])); switch ($type) { case 'gpvar': t3lib_div::deprecationLog('Using gpvar in TypoScript getText is deprecated since TYPO3 4.3 - Use gp instead of gpvar.'); // Fall Through // Fall Through case 'gp': // Merge GET and POST and get $key out of the merged array $retVal = $this->getGlobal($key, t3lib_div::array_merge_recursive_overrule(t3lib_div::_GET(), t3lib_div::_POST())); break; case 'tsfe': $retVal = $this->getGlobal('TSFE|' . $key); break; case 'getenv': $retVal = getenv($key); break; case 'getindpenv': $retVal = t3lib_div::getIndpEnv($key); break; case 'field': $retVal = $fieldArray[$key]; break; case 'parameters': $retVal = $this->parameters[$key]; break; case 'register': $retVal = $GLOBALS['TSFE']->register[$key]; break; case 'global': $retVal = $this->getGlobal($key); break; case 'leveltitle': $nkey = $this->getKey($key, $GLOBALS['TSFE']->tmpl->rootLine); $retVal = $this->rootLineValue($nkey, 'title', stristr($key, 'slide')); break; case 'levelmedia': $nkey = $this->getKey($key, $GLOBALS['TSFE']->tmpl->rootLine); $retVal = $this->rootLineValue($nkey, 'media', stristr($key, 'slide')); break; case 'leveluid': $nkey = $this->getKey($key, $GLOBALS['TSFE']->tmpl->rootLine); $retVal = $this->rootLineValue($nkey, 'uid', stristr($key, 'slide')); break; case 'levelfield': $keyP = t3lib_div::trimExplode(',', $key); $nkey = $this->getKey($keyP[0], $GLOBALS['TSFE']->tmpl->rootLine); $retVal = $this->rootLineValue($nkey, $keyP[1], strtolower($keyP[2]) == 'slide'); break; case 'fullrootline': $keyP = t3lib_div::trimExplode(',', $key); $fullKey = intval($keyP[0]) - count($GLOBALS['TSFE']->tmpl->rootLine) + count($GLOBALS['TSFE']->rootLine); if ($fullKey >= 0) { $retVal = $this->rootLineValue($fullKey, $keyP[1], stristr($keyP[2], 'slide'), $GLOBALS['TSFE']->rootLine); } break; case 'date': if (!$key) { $key = 'd/m Y'; } $retVal = date($key, $GLOBALS['EXEC_TIME']); break; case 'page': $retVal = $GLOBALS['TSFE']->page[$key]; break; case 'current': $retVal = $this->data[$this->currentValKey]; break; case 'level': $retVal = count($GLOBALS['TSFE']->tmpl->rootLine) - 1; break; case 'db': $selectParts = t3lib_div::trimExplode(':', $key); $db_rec = $GLOBALS['TSFE']->sys_page->getRawRecord($selectParts[0], $selectParts[1]); if (is_array($db_rec) && $selectParts[2]) { $retVal = $db_rec[$selectParts[2]]; } break; case 'lll': $retVal = $GLOBALS['TSFE']->sL('LLL:' . $key); break; case 'path': $retVal = $GLOBALS['TSFE']->tmpl->getFileName($key); break; case 'cobj': switch ((string) $key) { case 'parentRecordNumber': $retVal = $this->parentRecordNumber; break; } break; case 'debug': switch ((string) $key) { case 'rootLine': $retVal = t3lib_utility_Debug::viewArray($GLOBALS['TSFE']->tmpl->rootLine); break; case 'fullRootLine': $retVal = t3lib_utility_Debug::viewArray($GLOBALS['TSFE']->rootLine); break; case 'data': $retVal = t3lib_utility_Debug::viewArray($this->data); break; } break; } } if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['getData'])) { foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['getData'] as $classData) { $hookObject = t3lib_div::getUserObj($classData); if (!$hookObject instanceof tslib_content_getDataHook) { throw new UnexpectedValueException('$hookObject must implement interface tslib_content_getDataHook', 1195044480); } $retVal = $hookObject->getDataExtension($string, $fieldArray, $secVal, $retVal, $this); } } } return $retVal; }
/** * Prints the debug output of an array * * Compatibility wrapper for obsolete Core methods * * @param array $array Array to output * @return string */ protected function debugArray($array) { if (class_exists('t3lib_utility_Debug')) { return t3lib_utility_Debug::viewArray($array); } else { t3lib_div::view_array($array); } }
/** * [Describe function...] * * @param [type] $mQ: ... * @param [type] $res: ... * @param [type] $table: ... * @return [type] ... */ function getQueryResultCode($mQ, $res, $table) { global $TCA; $output = ''; $cPR = array(); switch ($mQ) { case 'count': $row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res); $cPR['header'] = 'Count'; $cPR['content'] = '<BR><strong>' . $row[0] . '</strong> records selected.'; break; case 'all': $rowArr = array(); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $rowArr[] = $this->resultRowDisplay($row, $TCA[$table], $table); $lrow = $row; } if (is_array($this->hookArray['beforeResultTable'])) { foreach ($this->hookArray['beforeResultTable'] as $_funcRef) { $out .= t3lib_div::callUserFunction($_funcRef, $GLOBALS['SOBE']->MOD_SETTINGS, $this); } } if (count($rowArr)) { $out .= '<table border="0" cellpadding="2" cellspacing="1" width="100%">' . $this->resultRowTitles($lrow, $TCA[$table], $table) . implode(LF, $rowArr) . '</table>'; } if (!$out) { $out = '<em>No rows selected!</em>'; } $cPR['header'] = 'Result'; $cPR['content'] = $out; break; case 'csv': $rowArr = array(); $first = 1; while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { if ($first) { $rowArr[] = $this->csvValues(array_keys($row), ',', ''); $first = 0; } $rowArr[] = $this->csvValues($row, ',', '"', $TCA[$table], $table); } if (count($rowArr)) { $out .= '<textarea name="whatever" rows="20" wrap="off"' . $GLOBALS['SOBE']->doc->formWidthText($this->formW, '', 'off') . ' class="fixed-font">' . t3lib_div::formatForTextarea(implode(LF, $rowArr)) . '</textarea>'; if (!$this->noDownloadB) { $out .= '<BR><input type="submit" name="download_file" value="Click to download file" onClick="window.location.href=\'' . $this->downloadScript . '\';">'; // document.forms[0].target=\'_blank\'; } // Downloads file: if (t3lib_div::_GP('download_file')) { $filename = 'TYPO3_' . $table . '_export_' . date('dmy-Hi') . '.csv'; $mimeType = 'application/octet-stream'; header('Content-Type: ' . $mimeType); header('Content-Disposition: attachment; filename=' . $filename); echo implode(CRLF, $rowArr); exit; } } if (!$out) { $out = '<em>No rows selected!</em>'; } $cPR['header'] = 'Result'; $cPR['content'] = $out; break; case 'xml': $xmlObj = t3lib_div::makeInstance('t3lib_xml', 'typo3_export'); $xmlObj->includeNonEmptyValues = 1; $xmlObj->renderHeader(); $first = 1; while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { if ($first) { $xmlObj->setRecFields($table, implode(',', array_keys($row))); $first = 0; } $valueArray = $row; if ($GLOBALS['SOBE']->MOD_SETTINGS['search_result_labels']) { foreach ($valueArray as $key => $val) { $valueArray[$key] = $this->getProcessedValueExtra($table, $key, $val, array(), ','); } } $xmlObj->addRecord($table, $valueArray); } $xmlObj->renderFooter(); if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) { $xmlData = $xmlObj->getResult(); $out .= '<textarea name="whatever" rows="20" wrap="off"' . $GLOBALS['SOBE']->doc->formWidthText($this->formW, '', 'off') . ' class="fixed-font">' . t3lib_div::formatForTextarea($xmlData) . '</textarea>'; if (!$this->noDownloadB) { $out .= '<BR><input type="submit" name="download_file" value="Click to download file" onClick="window.location.href=\'' . $this->downloadScript . '\';">'; // document.forms[0].target=\'_blank\'; } // Downloads file: if (t3lib_div::_GP('download_file')) { $filename = 'TYPO3_' . $table . '_export_' . date('dmy-Hi') . '.xml'; $mimeType = 'application/octet-stream'; header('Content-Type: ' . $mimeType); header('Content-Disposition: attachment; filename=' . $filename); echo $xmlData; exit; } } if (!$out) { $out = '<em>No rows selected!</em>'; } $cPR['header'] = 'Result'; $cPR['content'] = $out; break; case 'explain': default: while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $out .= '<br />' . t3lib_utility_Debug::viewArray($row); } $cPR['header'] = 'Explain SQL query'; $cPR['content'] = $out; break; } return $cPR; }
/** * Renders the hierarchical display for a Data Structure. * Calls itself recursively * * @param array Part of Data Structure (array of elements) * @param boolean If true, the Data Structure table will show links for mapping actions. Otherwise it will just layout the Data Structure visually. * @param array Part of Current mapping information corresponding to the $dataStruct array - used to evaluate the status of mapping for a certain point in the structure. * @param array Array of HTML paths * @param array Options for mapping mode control (INNER, OUTER etc...) * @param array Content from template file splitted by current mapping info - needed to evaluate whether mapping information for a certain level actually worked on live content! * @param integer Recursion level, counting up * @param array Accumulates the table rows containing the structure. This is the array returned from the function. * @param string Form field prefix. For each recursion of this function, two [] parts are added to this prefix * @param string HTML path. For each recursion a section (divided by "|") is added. * @param boolean If true, the "Map" link can be shown, otherwise not. Used internally in the recursions. * @return array Table rows as an array of <tr> tags, $tRows */ function drawDataStructureMap($dataStruct,$mappingMode=0,$currentMappingInfo=array(),$pathLevels=array(),$optDat=array(),$contentSplittedByMapping=array(),$level=0,$tRows=array(),$formPrefix='',$path='',$mapOK=1) { $bInfo = t3lib_div::clientInfo(); $multilineTooltips = ($bInfo['BROWSER'] == 'msie'); $rowIndex = -1; // Data Structure array must be ... and array of course... if (is_array($dataStruct)) { foreach($dataStruct as $key => $value) { $rowIndex++; if ($key == 'meta') { // Do not show <meta> information in mapping interface! continue; } if (is_array($value)) { // The value of each entry must be an array. // ******************** // Making the row: // ******************** $rowCells=array(); // Icon: $info = $this->dsTypeInfo($value); $icon = '<img'.$info[2].' alt="" title="'.$info[1].$key.'" class="absmiddle" />'; // Composing title-cell: if (preg_match('/^LLL:/', $value['tx_templavoila']['title'])) { $translatedTitle = $GLOBALS['LANG']->sL($value['tx_templavoila']['title']); $translateIcon = '<sup title="' . $GLOBALS['LANG']->getLL('displayDSTitleTranslated') . '">*</sup>'; } else { $translatedTitle = $value['tx_templavoila']['title']; $translateIcon = ''; } $this->elNames[$formPrefix.'['.$key.']']['tx_templavoila']['title'] = $icon.'<strong>'.htmlspecialchars(t3lib_div::fixed_lgd_cs($translatedTitle, 30)).'</strong>'.$translateIcon; $rowCells['title'] = '<img src="clear.gif" width="'.($level*16).'" height="1" alt="" />'.$this->elNames[$formPrefix.'['.$key.']']['tx_templavoila']['title']; // Description: $this->elNames[$formPrefix.'['.$key.']']['tx_templavoila']['description'] = $rowCells['description'] = htmlspecialchars($value['tx_templavoila']['description']); // In "mapping mode", render HTML page and Command links: if ($mappingMode) { // HTML-path + CMD links: $isMapOK = 0; if ($currentMappingInfo[$key]['MAP_EL']) { // If mapping information exists...: $mappingElement = str_replace('~~~', ' ', $currentMappingInfo[$key]['MAP_EL']); if (isset($contentSplittedByMapping['cArray'][$key])) { // If mapping of this information also succeeded...: $cF = implode(chr(10),t3lib_div::trimExplode(chr(10),$contentSplittedByMapping['cArray'][$key],1)); if (strlen($cF)>200) { $cF = t3lib_div::fixed_lgd_cs($cF,90).' '.t3lib_div::fixed_lgd_cs($cF,-90); } // Render HTML path: list($pI) = $this->markupObj->splitPath($currentMappingInfo[$key]['MAP_EL']); $tagIcon = t3lib_iconWorks::skinImg($this->doc->backPath, t3lib_extMgm::extRelPath('templavoila') . 'html_tags/' . $pI['el'] . '.gif', 'height="17"') . ' alt="" border="0"'; $okTitle = htmlspecialchars($cF ? sprintf($GLOBALS['LANG']->getLL('displayDSContentFound'), strlen($contentSplittedByMapping['cArray'][$key])) . ($multilineTooltips ? ':' . chr(10) . chr(10) . $cF : '') : $GLOBALS['LANG']->getLL('displayDSContentEmpty')); $rowCells['htmlPath'] = t3lib_iconWorks::getSpriteIcon('status-dialog-ok', array('title' => $okTitle)). tx_templavoila_htmlmarkup::getGnyfMarkup($pI['el'], '---' . htmlspecialchars(t3lib_div::fixed_lgd_cs($mappingElement, -80)) ). ($pI['modifier'] ? $pI['modifier'] . ($pI['modifier_value'] ? ':' . ($pI['modifier'] != 'RANGE' ? $pI['modifier_value'] : '...') : '') : ''); $rowCells['htmlPath'] = '<a href="'.$this->linkThisScript(array( 'htmlPath'=>$path.($path?'|':'').preg_replace('/\/[^ ]*$/','',$currentMappingInfo[$key]['MAP_EL']), 'showPathOnly'=>1, 'DS_element' => t3lib_div::_GP('DS_element') )).'">'.$rowCells['htmlPath'].'</a>'; // CMD links, default content: $rowCells['cmdLinks'] = '<span class="nobr"><input type="submit" value="Re-Map" name="_" onclick="document.location=\'' . $this->linkThisScript(array( 'mapElPath' => $formPrefix . '[' . $key . ']', 'htmlPath' => $path, 'mappingToTags' => $value['tx_templavoila']['tags'], 'DS_element' => t3lib_div::_GP('DS_element') )) . '\';return false;" title="' . $GLOBALS['LANG']->getLL('buttonRemapTitle') . '" />' . '<input type="submit" value="' . $GLOBALS['LANG']->getLL('buttonChangeMode') . '" name="_" onclick="document.location=\'' . $this->linkThisScript(array( 'mapElPath' => $formPrefix . '[' . $key . ']', 'htmlPath' => $path . ($path ? '|' :'') . $pI['path'], 'doMappingOfPath' => 1, 'DS_element' => t3lib_div::_GP('DS_element') )) . '\';return false;" title="' . $GLOBALS['LANG']->getLL('buttonChangeMode') . '" /></span>'; // If content mapped ok, set flag: $isMapOK=1; } else { // Issue warning if mapping was lost: $rowCells['htmlPath'] = t3lib_iconWorks::getSpriteIcon('status-dialog-warning', array('title' => $GLOBALS['LANG']->getLL('msgNoContentFound'))) . htmlspecialchars($mappingElement); } } else { // For non-mapped cases, just output a no-break-space: $rowCells['htmlPath'] = ' '; } // CMD links; Content when current element is under mapping, then display control panel or message: if ($this->mapElPath == $formPrefix.'['.$key.']') { if ($this->doMappingOfPath) { // Creating option tags: $lastLevel = end($pathLevels); $tagsMapping = $this->explodeMappingToTagsStr($value['tx_templavoila']['tags']); $mapDat = is_array($tagsMapping[$lastLevel['el']]) ? $tagsMapping[$lastLevel['el']] : $tagsMapping['*']; unset($mapDat['']); if (is_array($mapDat) && !count($mapDat)) unset($mapDat); // Create mapping options: $didSetSel=0; $opt=array(); foreach($optDat as $k => $v) { list($pI) = $this->markupObj->splitPath($k); if (($value['type']=='attr' && $pI['modifier']=='ATTR') || ($value['type']!='attr' && $pI['modifier']!='ATTR')) { if ( (!$this->markupObj->tags[$lastLevel['el']]['single'] || $pI['modifier']!='INNER') && (!is_array($mapDat) || ($pI['modifier']!='ATTR' && isset($mapDat[strtolower($pI['modifier']?$pI['modifier']:'outer')])) || ($pI['modifier']=='ATTR' && (isset($mapDat['attr']['*']) || isset($mapDat['attr'][$pI['modifier_value']])))) ) { if($k==$currentMappingInfo[$key]['MAP_EL']) { $sel = ' selected="selected"'; $didSetSel=1; } else { $sel = ''; } $opt[]='<option value="'.htmlspecialchars($k).'"'.$sel.'>'.htmlspecialchars($v).'</option>'; } } } // Finally, put together the selector box: $rowCells['cmdLinks'] = tx_templavoila_htmlmarkup::getGnyfMarkup($pI['el'], '---' . htmlspecialchars(t3lib_div::fixed_lgd_cs($lastLevel['path'], -80)) ). '<br /><select name="dataMappingForm'.$formPrefix.'['.$key.'][MAP_EL]"> '.implode(' ',$opt).' <option value=""></option> </select> <br /> <input type="submit" name="_save_data_mapping" value="' . $GLOBALS['LANG']->getLL('buttonSet') . '" /> <input type="submit" name="_" value="' . $GLOBALS['LANG']->getLL('buttonCancel') . '" />'; $rowCells['cmdLinks'].= $this->cshItem('xMOD_tx_templavoila','mapping_modeset',$this->doc->backPath,'',FALSE,'margin-bottom: 0px;'); } else { $rowCells['cmdLinks'] = t3lib_iconWorks::getSpriteIcon('status-dialog-notification') . ' <strong>' . $GLOBALS['LANG']->getLL('msgHowToMap') . '</strong>'; $rowCells['cmdLinks'].= '<br /> <input type="submit" value="' . $GLOBALS['LANG']->getLL('buttonCancel') . '" name="_" onclick="document.location=\'' . $this->linkThisScript(array( 'DS_element' => t3lib_div::_GP('DS_element') )) .'\';return false;" />'; } } elseif (!$rowCells['cmdLinks'] && $mapOK && $value['type']!='no_map') { $rowCells['cmdLinks'] = '<input type="submit" value="' . $GLOBALS['LANG']->getLL('buttonMap') . '" name="_" onclick="document.location=\'' . $this->linkThisScript(array( 'mapElPath' => $formPrefix . '[' . $key . ']', 'htmlPath' => $path, 'mappingToTags' => $value['tx_templavoila']['tags'], 'DS_element' => t3lib_div::_GP('DS_element') )) . '\';return false;" />'; } } // Display mapping rules: $rowCells['tagRules'] = implode('<br />', t3lib_div::trimExplode(',', strtolower($value['tx_templavoila']['tags']), 1)); if (!$rowCells['tagRules']) { $rowCells['tagRules'] = $GLOBALS['LANG']->getLL('all'); } // Display edit/delete icons: if ($this->editDataStruct) { $editAddCol = '<a href="' . $this->linkThisScript(array( 'DS_element' => $formPrefix . '[' . $key . ']' )) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open', array('title' => $GLOBALS['LANG']->getLL('editEntry'))). '</a> <a href="' . $this->linkThisScript(array( 'DS_element_DELETE' => $formPrefix . '[' . $key . ']' )) . '" onClick="return confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('confirmDeleteEntry')) . ');">' . t3lib_iconWorks::getSpriteIcon('actions-edit-delete', array('title' => $GLOBALS['LANG']->getLL('deleteEntry'))). '</a>'; $editAddCol = '<td nowrap="nowrap">' . $editAddCol . '</td>'; } else { $editAddCol = ''; } // Description: if ($this->_preview) { if (!is_array($value['tx_templavoila']['sample_data'])) { $rowCells['description'] = '[' . $GLOBALS['LANG']->getLL('noSampleData') . ']'; } elseif (tx_templavoila_div::convertVersionNumberToInteger(TYPO3_version) < 4005000){ $rowCells['description'] = t3lib_div::view_array($value['tx_templavoila']['sample_data']); } else { $rowCells['description'] = t3lib_utility_Debug::viewArray($value['tx_templavoila']['sample_data']); } } // Getting editing row, if applicable: list($addEditRows, $placeBefore) = $this->dsEdit->drawDataStructureMap_editItem($formPrefix, $key, $value, $level, $rowCells); // Add edit-row if found and destined to be set BEFORE: if ($addEditRows && $placeBefore) { $tRows[]= $addEditRows; } else // Put row together if (!$this->mapElPath || $this->mapElPath == $formPrefix.'['.$key.']') { $tRows[]=' <tr class="' . ($rowIndex % 2 ? 'bgColor4' : 'bgColor6') . '"> <td nowrap="nowrap" valign="top">'.$rowCells['title'].'</td> '.($this->editDataStruct ? '<td nowrap="nowrap">'.$key.'</td>' : '').' <td>'.$rowCells['description'].'</td> '.($mappingMode ? '<td nowrap="nowrap">'.$rowCells['htmlPath'].'</td> <td>'.$rowCells['cmdLinks'].'</td>' : '' ).' <td>'.$rowCells['tagRules'].'</td> '.$editAddCol.' </tr>'; } // Recursive call: if (($value['type']=='array') || ($value['type']=='section')) { $tRows = $this->drawDataStructureMap( $value['el'], $mappingMode, $currentMappingInfo[$key]['el'], $pathLevels, $optDat, $contentSplittedByMapping['sub'][$key], $level+1, $tRows, $formPrefix.'['.$key.'][el]', $path.($path?'|':'').$currentMappingInfo[$key]['MAP_EL'], $isMapOK ); } // Add edit-row if found and destined to be set AFTER: if ($addEditRows && !$placeBefore) { $tRows[]= $addEditRows; } } } } return $tRows; }
/** * @test */ public function relatedCanBeFetchedFromRelatedAndRelatedFrom() { $relatedFrom = NULL; $related = NULL; $this->newsDomainModelInstance->setRelated($related); $this->newsDomainModelInstance->setRelatedFrom($relatedFrom); // 1st: Empty relations $this->assertEquals(array(), $this->newsDomainModelInstance->getAllRelatedSorted()); $related = new Tx_Extbase_Persistence_ObjectStorage(); $item1 = $this->getNewsRecordForRelated('title2', '20.01.2013'); $item2 = $this->getNewsRecordForRelated('title1', '20.02.2013'); $item3 = $this->getNewsRecordForRelated('title3', '10.01.2013'); $item4 = $this->getNewsRecordForRelated('title4', '1.01.2013'); $item5 = $this->getNewsRecordForRelated('title5', '12.10.2013'); $related->attach($item1); $related->attach($item2); $this->newsDomainModelInstance->setRelated($related); $result = array($item2, $item1); // 2nd: + 2 Relations in related $this->assertEquals($result, $this->newsDomainModelInstance->getAllRelatedSorted(), t3lib_utility_Debug::viewArray($debug)); // 3rd: + 1 relation in relatedFrom $relatedFrom = new Tx_Extbase_Persistence_ObjectStorage(); $relatedFrom->attach($item3); $result = array($item2, $item1, $item3); $this->newsDomainModelInstance->setRelatedFrom($relatedFrom); $this->assertEquals($result, $this->newsDomainModelInstance->getAllRelatedSorted(), t3lib_utility_Debug::viewArray($debug)); // 4th: + 1 relation in relatedFrom, + 1 relation in related $relatedFrom->attach($item4); $this->newsDomainModelInstance->setRelatedFrom($relatedFrom); $related->attach($item5); $this->newsDomainModelInstance->setRelated($related); $result = array($item5, $item2, $item1, $item3, $item4); $this->assertEquals($result, $this->newsDomainModelInstance->getAllRelatedSorted(), t3lib_utility_Debug::viewArray($debug)); }
/** * Methods handles the database query to test the WURFL library. * * @return void */ protected function handleQueryDatabase() { $agent = $hAgent = null; if ($_REQUEST['cmd']['queryDatabase'] && trim($_REQUEST['inputCalc']['agent']['input'])) { $agent = trim($_REQUEST['inputCalc']['agent']['input']); $hAgent = htmlspecialchars($agent); $hAgentDefault = $hAgent; } else { $hAgentDefault = htmlspecialchars($_SERVER['HTTP_USER_AGENT']); } $content = $this->getContentHead(); $content .= <<<HTML <div class="wurfl-module"> <h4>Input a USER-AGENT string, e.g.</h4> <ul> <li>Mozilla/5.0 (iPhone; CPU iPhone OS 5_1 like Mac OS X) AppleWebKit/534.46</li> <li>BlackBerry_4</li> <li>NokiaC2-05.1/2.0 (08.45) Profile/MIDP-2.1 Configuration/CLDC-1.1</li> </ul> <br/> <input type="text" name="inputCalc[agent][input]" size="80" value="{$hAgentDefault}"/> <br /><br/> <input type="submit" name="cmd[queryDatabase]" value="Submit" /> </div> HTML; if ($agent) { $wurfl = new Tx_ContextsWurfl_Api_Wurfl($agent); $brandName = $wurfl->capabilities['product_info']['brand_name']; $modelName = $wurfl->capabilities['product_info']['model_name']; $arrayOutput = t3lib_utility_Debug::viewArray($wurfl->capabilities); $content .= <<<HTML <div class="wurfl-module"> <h3>Details for the <em>{$brandName} {$modelName}</em></h3> <p>User agent: <code>{$hAgent}</code</p> <div class="wurfl-module">{$arrayOutput}</div> </div> HTML; } $this->content .= $this->doc->section('Query WURFL for user agent capabilities', $content, false, true); }