$conf = $TCA[$table]; foreach ($row as $fieldName => $fieldValue) { $title = $GLOBALS['LANG']->sL($conf['columns'][$fieldName]['label'] ? $conf['columns'][$fieldName]['label'] : $fieldName, 1); $tableHeader[$fieldName] = $title; } return $tableHeader; } /** * Get the result row with getProcessedValueExtra() * It allow you to respect the TCA rules * * @param array $row * @param string $table * @return array */ public static function getResultRow($row, $table) { $record = array(); foreach ($row as $fieldName => $fieldValue) { if (TYPO3_MODE == 'FE') { // $GLOBALS['TSFE']->includeTCA(); $GLOBALS['LANG'] = TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Lang\\LanguageService'); $GLOBALS['LANG']->init($GLOBALS['TSFE']->tmpl->setup['config.']['language']); } $record[$fieldName] = \TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValueExtra($table, $fieldName, $fieldValue, 0, $row['uid']); } return $record; } } tx_t3devapi_miscellaneous::XCLASS('ext/t3devapi/class.tx_t3devapi_database.php');
if ($weekday > 0) { for ($i = 1; $i <= $weekday; $i++) { $calendar .= '<td class="noDay"> </td>'; } } for ($day = 1, $days_in_month = gmdate('t', $first_of_month); $day <= $days_in_month; $day++, $weekday++) { if ($weekday == 7) { $weekday = 0; //start a new week $calendar .= "</tr>\n<tr>"; } if (isset($days[$day]) and is_array($days[$day])) { @(list($link, $classes, $content) = $days[$day]); if (is_NULL($content)) { $content = $day; } $calendar .= '<td' . ($classes ? ' class="' . htmlspecialchars($classes) . '">' : '>') . ($link ? '<a href="' . htmlspecialchars($link) . '">' . $content . '</a>' : $content) . '</td>'; } else { $calendar .= "<td>{$day}</td>"; } } if ($weekday != 7) { for ($i = 1; $i <= 7 - $weekday; $i++) { $calendar .= '<td class="noDay"> </td>'; } } return $calendar . "</tr>\n</table>\n"; } } tx_t3devapi_miscellaneous::XCLASS('ext/t3devapi/class.tx_t3devapi_calendar.php');
// Next if ($currentPage + 1 <= $totalPages) { $labelNext = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:next'); $next = '<a href="' . $listURL . '&pointer=' . $currentPage * $iLimit . '"><img width="16" height="16" title="' . $labelNext . '" alt="' . $labelNext . '" src="sysext/t3skin/icons/gfx/control_next.gif"></a>'; } else { $next = '<img width="16" height="16" title="" alt="" src="sysext/t3skin/icons/gfx/control_next_disabled.gif">'; } // Last if ($currentPage != $totalPages) { $labelLast = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:last'); $last = '<a href="' . $listURL . '&pointer=' . ($totalPages - 1) * $iLimit . '"><img width="16" height="16" title="' . $labelLast . '" alt="' . $labelLast . '" src="sysext/t3skin/icons/gfx/control_last.gif"></a>'; } else { $last = '<img width="16" height="16" title="" alt="" src="sysext/t3skin/icons/gfx/control_last_disabled.gif">'; } $pageNumberInput = '<span>' . $currentPage . '</span>'; $pageIndicator = '<span class="pageIndicator">' . sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:pageIndicator'), $pageNumberInput, $totalPages) . '</span>'; if ($totalItems > $firstElementNumber + $iLimit) { $lastElementNumber = $firstElementNumber + $iLimit; } else { $lastElementNumber = $totalItems; } $rangeIndicator = '<span class="pageIndicator">' . sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:rangeIndicator'), $firstElementNumber + 1, $lastElementNumber) . '</span>'; $reload = '<input type="text" name="nbPerPage" id="nbPerPage" size="5" value="' . $iLimit . '"/> / page ' . '<a href="#" onClick="jumpToUrl(\'' . $listURLOrig . '&nbPerPage=\'+document.getElementById(\'nbPerPage\').value);">' . '<img width="16" height="16" title="" alt="" src="sysext/t3skin/icons/gfx/refresh_n.gif"></a>'; $content .= '<div id="typo3-dblist-pagination">' . $first . $previous . '<span class="bar"> </span>' . $rangeIndicator . '<span class="bar"> </span>' . $pageIndicator . '<span class="bar"> </span>' . $next . $last . '<span class="bar"> </span>' . $reload . '</div>'; $returnContent = $content; } return $returnContent; } } tx_t3devapi_miscellaneous::XCLASS('ext/t3devapi/class.tx_t3devapi_befunc.php');
* * @param mixed $template */ public function __construct($template) { $this->template = $template; } /** * Loads a template file and generate the content * * @param array $context datas to send * @return string */ public function fluidView($context = array()) { $renderer = TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Fluid_View_TemplateView'); $controllerContext = TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Extbase_MVC_Controller_ControllerContext'); $controllerContext->setRequest(TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Extbase_MVC_Web_Request')); $renderer->setControllerContext($controllerContext); $renderer->setPartialRootPath(TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey) . "res/partials/"); $renderer->setTemplateRootPath(TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey) . "res/templates/"); $renderer->setLayoutRootPath(TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey) . "res/layouts"); $renderer->setTemplatePathAndFilename($this->template); foreach ($context as $key => $value) { $renderer->assign($key, $value); } return $renderer->render(); } } tx_t3devapi_miscellaneous::XCLASS('ext/t3devapi/class.tx_t3devapi_fluid.php');
{ /** * Constructor */ public function __construct() { } /** * tx_t3devapi_export::exportRecordsToXML() * Example : * $query['SELECT'] = 'uid,title,category'; * $query['FROM'] = 'tt_news'; * $query['WHERE'] = ''; * * @param array $query * @return string */ public function exportRecordsToXML($query) { $xmlObj = TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_xml', 'typo3_export'); $xmlObj->setRecFields($query['FROM'], $query['SELECT']); $xmlObj->renderHeader(); $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($query['SELECT'], $query['FROM'], $query['WHERE'], $query['GROUPBY'], $query['ORDERBY'], $query['LIMIT']); $xmlObj->renderRecords($query['FROM'], $res); $xmlObj->renderFooter(); $GLOBALS['TYPO3_DB']->sql_free_result($res); return $xmlObj->getResult(); } } tx_t3devapi_miscellaneous::XCLASS('ext/t3devapi/class.tx_t3devapi_export.php');
foreach ($piFlexForm['data'] as $sheet => $data) { foreach ($data as $lang => $value) { foreach ($value as $key => $val) { $flexConfig[$key] = $this->pi_getFFvalue($piFlexForm, $key, $sheet); } } } } // test contentId to know if this content is concerned by piVars $arrayConfig['contentId'] == $this->cObj->data['uid'] ? $arrayConfig['piVars'] = 1 : ($arrayConfig['piVars'] = 0); // add "ext_conf_template.txt" if ($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$this->extKey]) { $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$this->extKey]); $arrayConfig = array_merge($arrayConfig, $extConf); } // add the pi config "plugin.tx_xxxx_pi1 = xxxx" which is not imported in the $conf if (is_array($GLOBALS['TSFE']->tmpl->setup['plugin.'][$this->prefixId . '.'])) { $arrayConfig = array_merge($arrayConfig, $GLOBALS['TSFE']->tmpl->setup['plugin.'][$this->prefixId . '.']); } // add $piVars $arrayConfig = array_merge($arrayConfig, $this->piVars); // merge TYPOSCRIPT with FLEXFORM $arrayConfig = array_merge($flexConfig, $arrayConfig); if ($debug == true) { tx_t3devapi_miscellaneous::debug($arrayConfig); } return $arrayConfig; } } tx_t3devapi_miscellaneous::XCLASS('ext/t3devapi/class.tx_t3devapi_config.php');
* @param string $value * @param string $param * @param string $error * @return bool */ public function isRegexp($value, $param, $error) { if (!preg_match($param, $value)) { $this->setError($error); return false; } return true; } /** * Check if teh value is an URI * * @param string $value * @param string $error * @return bool */ public function isUri($value, $error) { if (!preg_match('/^(?#Protocol)(?:(?:ht|f)tp(?:s?)\\:\\/\\/|~\\/|\\/)?(?#Username:Password)(?:\\w+:\\w+@)?(?#Subdomains)(?:(?:[-\\w]+\\.)+(?#TopLevel Domains)(?:com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|travel|[a-z]{2}))(?#Port)(?::[\\d]{1,5})?(?#Directories)(?:(?:(?:\\/(?:[-\\w~!$+|.,=]|%[a-f\\d]{2})+)+|\\/)+|\\?|#)?(?#Query)(?:(?:\\?(?:[-\\w~!$+|.,*:]|%[a-f\\d{2}])+=?(?:[-\\w~!$+|.,*:=]|%[a-f\\d]{2})*)(?:&(?:[-\\w~!$+|.,*:]|%[a-f\\d{2}])+=?(?:[-\\w~!$+|.,*:=]|%[a-f\\d]{2})*)*)*(?#Anchor)(?:#(?:[-\\w~!$+|.,*:=]|%[a-f\\d]{2})*)?$/', $value)) { $this->setError($error); return false; } return true; } } tx_t3devapi_miscellaneous::XCLASS('ext/t3devapi/class.tx_t3devapi_validate.php');
/** * Get all the subparts of a content * * @param string $template * @return array */ protected function getTemplateSubpartTagList($template) { $tagList = array(); $orderedTagList = array(); preg_match_all('/<!--.*?###(.*?)###.*?-->/', $template, $res, PREG_OFFSET_CAPTURE | PREG_PATTERN_ORDER); foreach ($res[0] as $k => $v) { $type = 'open'; if (isset($tagList[$res[1][$k][0]])) { $type = 'close'; } $tagList[$res[1][$k][0]][$type] = array('matchedTag' => $v[0], 'tagName' => $res[1][$k][0], 'offset' => $v[1], 'type' => $type); if ($type == 'close') { $orderedTagList[$res[1][$k][0]] = array($tagList[$res[1][$k][0]]['open'], $tagList[$res[1][$k][0]]['close']); } } unset($tagList); foreach ($orderedTagList as $tagKey => $tagValue) { $orderedTagList[$tagKey]['content'] = $this->getSubpart($template, '###' . $tagKey . '###'); $orderedTagList[$tagKey]['markers'] = $this->getMarkersFromTemplate($orderedTagList[$tagKey]['content']); } return $orderedTagList; } } tx_t3devapi_miscellaneous::XCLASS('ext/t3devapi/class.tx_t3devapi_templating.php');
* Start to profile with xhprof * * @return void */ public function profilerStart() { if (extension_loaded('xhprof')) { include_once $this->xhprofLibPath . 'utils/xhprof_lib.php'; include_once $this->xhprofLibPath . 'utils/xhprof_runs.php'; xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY); } } /** * Stop to profile with xhprof * * @return void */ public function profilerStop() { if (extension_loaded('xhprof')) { $xhprofData = xhprof_disable(); $xhprofRuns = new XHProfRuns_Default(); $runId = $xhprofRuns->save_run($xhprofData, $this->xhprofNamespace); $profilerUrl = sprintf($this->xhprofHtmlPath . 'index.php?run=%s&source=%s', $runId, $this->xhprofNamespace); $styles = ' style="display: block; position: absolute; left: 5px; bottom: 5px; background: red; padding: 8px; z-index: 10000; color: #fff;"'; echo '<a href="' . $profilerUrl . '" target="_blank" ' . $styles . '>Profiler output</a>'; } } } tx_t3devapi_miscellaneous::XCLASS('ext/t3devapi/class.tx_t3devapi_profiler.php');