/** * get all content elements containing a t3s_content-Plugin * * @return array Array containing tt_content records */ public function getTtContentRecordsWithT3sPlugin() { $targetPid = intval($this->indexerConfig['targetpid']); if ($targetPid) { $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tt_content', '1=1' . ' AND pid=' . $targetPid . ' AND CType="list"' . ' AND list_type="t3s_content_pi1"' . ' AND hidden=0 AND deleted=0', '', '', '', 'uid'); if ($rows) { foreach ($rows as $key => $row) { if (TYPO3_VERSION_INTEGER >= 7000000) { $xml = TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($row['pi_flexform']); } else { $xml = t3lib_div::xml2array($row['pi_flexform']); } $config = $xml['data']['general']['lDEF']; $ttContentUids[] = $config['contentElements']['vDEF']; } $ttContentUids = implode(',', $ttContentUids); if (TYPO3_VERSION_INTEGER >= 7000000) { $ttContentUids = TYPO3\CMS\Core\Utility\GeneralUtility::uniqueList($ttContentUids); } else { $ttContentUids = t3lib_div::uniqueList($ttContentUids); } $ttContentRecords = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tt_content', ' uid IN (' . $ttContentUids . ')', '', '', '', 'uid'); if ($ttContentRecords) { return $ttContentRecords; } } } return array(); }
/** * Set the DB TCA field with an userfunction to allow dynamic manipulation * * @param array $PA: * @param array $fobj: * @return The TCA field */ function user_rgslideshow($PA, $fobj) { // get the correct tables which are allowed > tsconfig rgslideshow.tables $pid = $this->getStorageFolderPid($PA['row']['pid']); $pagesTSC = t3lib_BEfunc::getPagesTSconfig($pid); // get page TSconfig $table = $pagesTSC['rgslideshow.']['tables']; // if there are any tables set in TsConfig if ($table != '') { // get the old value to set this into the field $flexform = t3lib_div::xml2array($PA['row']['pi_flexform']); $imgOld = is_array($flexform) ? $flexform['data']['sDEF']['lDEF']['images2']['vDEF'] : ''; // configuration of the field, see TCA for more options $config = array('fieldConf' => array('label' => 'images2', 'config' => array('type' => 'group', 'prepend_tname' => 1, 'internal_type' => 'db', 'allowed' => $table, 'show_thumbs' => 1, 'size' => 10, 'autoSizeMax' => 20, 'maxitems' => 30, 'minitems' => 0, 'form_type' => 'group')), 'onFocus' => '', 'label' => 'Plugin Options', 'itemFormElValue' => $imgOld, 'itemFormElName' => 'data[tt_content][' . $PA['row']['uid'] . '][pi_flexform][data][sDEF][lDEF][images2][vDEF]', 'itemFormElName_file' => 'data_files[tt_content][' . $PA['row']['uid'] . '][pi_flexform][data][sDEF][lDEF][images2][vDEF]'); // create the element $form = t3lib_div::makeInstance('t3lib_TCEforms'); $form->initDefaultBEMode(); $form->backPath = $GLOBALS['BACK_PATH']; $element = $form->getSingleField_typeGroup('tt_content', 'pi_flexform', $PA['row'], $config); return $form->printNeededJSFunctions_top() . $element . $form->printNeededJSFunctions(); } else { // no tables allowed return '<div style="font-weight:bold;padding:1px 10px;margin:2px:5px"> No Table allowed. Set it in TsConfig with <pre>rgslideshow.tables = tt_news,pages,fe_users,...</pre> </div> '; } }
/** * Adds onchange listener on the drop down menu "predefined". * If the event is fired and old value was ".default", then empty some fields. * * @param array $config * @return string the javascript * @author Fabien Udriot */ function addFields_predefinedJS($config) { $newRecord = 'true'; if ($config['row']['pi_flexform'] != '') { $flexData = t3lib_div::xml2array($config['row']['pi_flexform']); if (isset($flexData['data']['sDEF']['lDEF']['predefined'])) { $newRecord = 'false'; } } $uid = key($GLOBALS['SOBE']->editconf['tt_content']); if ($uid < 0 || empty($uid) || !strstr($uid, 'NEW')) { $uid = $GLOBALS['SOBE']->elementsData[0]['uid']; } //print_r($GLOBALS['SOBE']->elementsData[0]); $js = "<script>\n"; $js .= "/*<![CDATA[*/\n"; $divId = $GLOBALS['SOBE']->tceforms->dynNestedStack[0][1]; if (!$divId) { //$divId = 'DTM-' . $uid; $divId = "DIV.c-tablayer"; } else { $divId .= "-DIV"; } $js .= "var uid = '" . $uid . "'\n"; $js .= "var flexformBoxId = '" . $divId . "'\n"; //$js .= "var flexformBoxId = 'DIV.c-tablayer'\n"; $js .= "var newRecord = " . $newRecord . "\n"; $js .= file_get_contents(t3lib_extMgm::extPath('formhandler') . 'Resources/JS/addFields_predefinedJS.js'); $js .= "/*]]>*/\n"; $js .= "</script>\n"; return $js; }
/** * Returns information about this extension's pi1 plugin * * @param array $params Parameters to the hook * @param mixed $pObj A reference to calling object * @return string Information about pi1 plugin */ public function getExtensionSummary(array $params, $pObj) { $result = $actionTranslationKey = ''; if ($this->showExtensionTitle()) { $result .= '<strong>' . $GLOBALS['LANG']->sL(self::LLPATH . 'pi1_title', TRUE) . '</strong>'; } if ($params['row']['list_type'] == self::KEY . '_pi1') { $this->flexformData = t3lib_div::xml2array($params['row']['pi_flexform']); // if flexform data is found $actions = $this->getFieldFromFlexform($this->flexformData, 'switchableControllerActions'); if (!empty($actions)) { $actionList = t3lib_div::trimExplode(';', $actions); // translate the first action into its translation $actionTranslationKey = strtolower(str_replace('->', '_', $actionList[0])); $actionTranslation = $GLOBALS['LANG']->sL(self::LLPATH . 'flexforms_general.mode.' . $actionTranslationKey); $result .= '<h5>' . $actionTranslation . '</h5>'; } else { $result = $GLOBALS['LANG']->sL(self::LLPATH . 'flexforms_general.mode.not_configured'); } if (is_array($this->flexformData)) { switch ($actionTranslationKey) { case 'news_list': $this->getStartingPoint(); $this->getTimeRestrictionSetting(); $this->getTopNewsRestrictionSetting(); $this->getOrderSettings(); $this->getCategorySettings(); $this->getArchiveSettings(); $this->getOffsetLimitSettings(); $this->getDetailPidSetting(); $this->getListPidSetting(); break; case 'news_detail': $this->getSingleNewsSettings(); $this->getDetailPidSetting(); break; case 'news_datemenu': $this->getStartingPoint(); $this->getTimeRestrictionSetting(); $this->getTopNewsRestrictionSetting(); $this->getDateMenuSettings(); $this->getCategorySettings(); break; case 'category_list': $this->getCategorySettings(FALSE); break; case 'tag_list': $this->getStartingPoint(FALSE); $this->getListPidSetting(); break; default: } // for all views $this->getOverrideDemandSettings(); $this->getTemplateLayoutSettings(); $result .= $this->renderSettingsAsTable($params['row']); } } return $result; }
function execute() { return 1; $pfad = 'fileadmin/medien/fakultaeten/allgemein/modulbeschreibungen'; $documentRoot = t3lib_div::getIndpEnv(TYPO3_DOCUMENT_ROOT); $pfadKomplett = $documentRoot . '/' . $pfad; $this->recursive_rm($pfadKomplett); return 1; $start = time(); $lsfStudiengangDaten = array(); $where = 'deleted=0 AND hidden=0 AND cType="list" AND list_type="he_tools_pi1"'; $contentElems = $GLOBALS['TYPO3_DB']->exec_SELECTquery('pid,pi_flexform', 'tt_content', $where); while ($daten = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($contentElems)) { $flexFormSettings = t3lib_div::xml2array($daten['pi_flexform']); $flexData = $flexFormSettings['data']['sDEF']['lDEF']; if (is_array($flexData)) { if ($flexData['mode']['vDEF'] == 'MODULUEBERSICHT_LSF') { $spoVersion = $flexData['spo_version']['vDEF']; $studiengang = $flexData['studiengang_lsf']['vDEF']; $vertiefung = $flexData['vertiefung_lsf']['vDEF']; $whereStudiengang = 'uid=' . $studiengang; $abfrageStudiengang = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_hetools_module_studiengaenge', $whereStudiengang); if ($datenStudiengang = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($abfrageStudiengang)) { $abschlussLsf = $datenStudiengang['lsf_abs']; $studiengangLsf = $datenStudiengang['lsf_stdg']; $fakultaet = $datenStudiengang['fakultaet']; $vertiefungenLsf = array(); $whereVertiefung = ' modstud_id=' . $studiengang; $abfrageVertiefung = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_hetools_module_vertiefungen', $whereVertiefung); while ($datenVertiefung = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($abfrageVertiefung)) { if (!empty($datenVertiefung['version'])) { if ($datenVertiefung['version'] == $spoVersion) { $vertiefungenLsf[] = $datenVertiefung['kuerzel']; } } else { $vertiefungenLsf[] = $datenVertiefung['kuerzel']; } } if (empty($lsfStudiengangDaten[$studiengang . $spoVersion])) { $lsfStudiengangDaten[$studiengang . $spoVersion] = array($abschlussLsf, $spoVersion, $fakultaet, $studiengangLsf, $vertiefungenLsf); } } } } } foreach ($lsfStudiengangDaten as $lsfStudiengang) { // PDF für den Studiengang speichern $this->createPdf($lsfStudiengang[0], $lsfStudiengang[1], $lsfStudiengang[2], $lsfStudiengang[3], ''); if (!empty($lsfStudiengang[4]) && count($lsfStudiengang[4]) > 0) { foreach ($lsfStudiengang[4] as $vertiefungLsf) { $this->createPdf($lsfStudiengang[0], $lsfStudiengang[1], $lsfStudiengang[2], $lsfStudiengang[3], $vertiefungLsf); } } } $ende = time(); $dauer = $ende - $start; t3lib_div::devLog('dauer: ' . $dauer . ' Sekunden', 'lsf_pdfs', 0); return 1; }
/** * Return Form Uid from Flexform settings * * @param array Config Array * @return int Form Uid */ protected function getFormFromFlexform($params) { $xml = $params['row']['pi_flexform']; $flexform = t3lib_div::xml2array($xml); if (is_array($flexform) && isset($flexform['data']['main']['lDEF']['settings.flexform.main.form']['vDEF'])) { return $flexform['data']['main']['lDEF']['settings.flexform.main.form']['vDEF']; } return 0; }
/** * Get the locallang for class use out of an XML file * * @return array Array of the locallang data */ function getLL() { $path2llXml = t3lib_extMgm::extPath('pdfcontroller') . 'locallang_db.xml'; $llXml = implode('', file($path2llXml)); $arr_ll = t3lib_div::xml2array($llXml, $NSprefix = '', $reportDocTag = false); $LOCAL_LANG = $arr_ll['data']; return $LOCAL_LANG; }
/** * * @param array $row * @return string */ protected function getPreviewData($row) { $data = ''; if (is_array($row) && $row['pi_flexform']) { $flexform = t3lib_div::xml2array($row['pi_flexform']); if (isset($flexform['data']['sDEF']['lDEF']['mmFile']['vDEF'])) { $data = '<span>' . $flexform['data']['sDEF']['lDEF']['mmFile']['vDEF'] . '</span>'; } } return $data; }
/** * reads a language file * * @throws LFException raised if no language content couldnt fetched * @return array language content */ protected function readLLFile() { // read xml into array $xmlContent = t3lib_div::xml2array(file_get_contents($this->absFile)); // check and return if (!is_array($xmlContent['data']) || !count($xmlContent['data'])) { throw new LFException('failure.search.noFileContent'); } // set header data $this->meta = $xmlContent['meta']; return $xmlContent['data']; }
function main() { $content = '<html><body>'; $conf = t3lib_div::_GP('P'); $conf['md5ID']; if ($conf['table'] == 'tx_datasources_datasource') { $dsRecord = t3lib_beFunc::getRecord($conf['table'], intval($conf['uid'])); if (is_array($dsRecord)) { $dsArr = t3lib_div::xml2array($dsRecord['configuration']); $dsConf = $dsArr['data']['sDEF']['lDEF']; $content .= '<p>Trying to connect with Host / DSN <strong>' . htmlspecialchars($dsConf['field_host']['vDEF']) . '</strong> with user <strong>' . htmlspecialchars($dsConf['field_username']['vDEF']) . '</strong> ... '; $dbConn =& ADONewConnection($dsConf['field_dbtype']['vDEF']); $dbConn->PConnect($dsConf['field_host']['vDEF'], $dsConf['field_username']['vDEF'], $dsConf['field_password']['vDEF'], $dsConf['field_dbname']['vDEF']); $dbConn->SetFetchMode(ADODB_FETCH_ASSOC); $content .= $dbConn->ErrorMsg(); if ($dbConn->_connectionID) { $content .= '</p>'; $query = 'SELECT * FROM ' . $dsConf['field_table']['vDEF']; $recordSet =& $dbConn->SelectLimit($query, 150); if (!$recordSet) { $content .= '<p>Query failed (' . htmlspecialchars($query) . '):<br />'; $content .= $dbConn->ErrorMsg() . '</p>'; } else { $content .= '<span style="color:green">successful!</span></p>'; $counter = 0; $content .= '<p>Showing the first 150 entries from the result recordset:</p>'; $content .= '<table border="1">'; while (!$recordSet->EOF) { $content .= '<tr>'; if ($counter == 0) { foreach (array_keys($recordSet->fields) as $key) { $content .= '<th>' . htmlspecialchars($key) . '</th>'; } $content .= '</tr><tr>'; } foreach (array_values($recordSet->fields) as $value) { $content .= '<td>' . htmlspecialchars($value) . ' </td>'; } $recordSet->MoveNext(); $counter++; $content .= '</tr>'; } $content .= '<table>'; } } } else { $content .= '<span style="color:red">failed!</span></p><p><strong>Error Message:</strong>' . $dbConn->ErrorMsg() . '</p>'; } } $content .= '</body></html>'; echo $content; }
/** * Returns information about this extension's pi1 plugin * * @param array $params Parameters to the hook * @param object $pObj A reference to calling object * @return string Information about pi1 plugin */ function getExtensionSummary($params, &$pObj) { if ($params['row']['list_type'] == 9) { $data = t3lib_div::xml2array($params['row']['pi_flexform']); if (is_array($data) && $data['data']['sDEF']['lDEF']['what_to_display']['vDEF']) { $result = sprintf($GLOBALS['LANG']->sL('LLL:EXT:tt_news/locallang.xml:cms_layout.mode'), $data['data']['sDEF']['lDEF']['what_to_display']['vDEF']); } if (!$result) { $result = $GLOBALS['LANG']->sL('LLL:EXT:tt_news/locallang.xml:cms_layout.not_configured'); } } return $result; }
/** * Main function * * @param string Absolute path to the selected PHP file * @param string Extension dir (local, global, system) relative to PATH_site * @return string HTML content. */ function main($phpFile, $extensionDir) { if (@is_file($phpFile)) { $fCheck = $this->checkLLfilename($phpFile); if (!$fCheck) { $fileContent = t3lib_div::xml2array(t3lib_div::getURL($phpFile)); if (@is_array($fileContent)) { return $this->renderForm($fileContent, $phpFile); } else { return 'ERROR: File is not XML: ' . $fileContent; } } else { return 'ERROR: ' . $fCheck; } } }
/** * Returns information about this extension's pi1 plugin * * @param array $params Parameters to the hook * @param object $pObj A reference to calling object * @return string Information about pi1 plugin */ function getExtensionSummary($params, &$pObj) { if ($params['row']['list_type'] == 'jfmulticontent_pi1') { $data = t3lib_div::xml2array($params['row']['pi_flexform']); if (is_array($data) && $data['data']['general']['lDEF']['style']['vDEF']) { $result = sprintf($GLOBALS['LANG']->sL('LLL:EXT:jfmulticontent/locallang.xml:cms_layout.style'), '<strong>' . $data['data']['general']['lDEF']['style']['vDEF'] . '</strong><br/>'); } if (!$result) { $result = $GLOBALS['LANG']->sL('LLL:EXT:jfmulticontent/locallang.xml:cms_layout.not_configured') . '<br/>'; } } if (t3lib_extMgm::isLoaded("templavoila")) { $result = strip_tags($result); } return $result; }
/** * the main method of the PlugIn * * @param string $content: The PlugIn content * @param array $conf: The PlugIn configuration * @return The content that is displayed on the website */ public function main($content, $conf) { // config global $TSFE; $local_cObj = $TSFE->cObj; // cObject $this->conf = $conf; $this->pi_setPiVarDefaults(); $this->pi_loadLL(); $this->div = t3lib_div::makeInstance('tx_wtcart_div'); // Create new instance for div functions $this->dynamicMarkers = t3lib_div::makeInstance('tx_wtcart_dynamicmarkers', $this->scriptRelPath); // Create new instance for dynamicmarker function $this->tmpl['minicart'] = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['main.']['template']), '###WTCART_MINICART###'); // Load FORM HTML Template $this->tmpl['minicart_empty'] = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['main.']['template']), '###WTCART_MINICART_EMPTY###'); // Load FORM HTML Template //Read Flexform $row = $this->pi_getRecord('tt_content', $this->cObj->data['uid']); $flexformData = t3lib_div::xml2array($row['pi_flexform']); $pid = $this->pi_getFFvalue($flexformData, 'pid', 'sDEF'); $count = $this->div->countProductsInCart($pid); if ($count) { $outerArr = array('count' => $count, 'minicart_gross' => $this->div->getGrossPrice($pid)); $local_cObj->start($outerArr, $this->conf['db.']['table']); foreach ((array) $this->conf['settings.']['fields.'] as $key => $value) { if (!stristr($key, '.')) { // no . $minicartMarkerArray['###' . strtoupper($key) . '###'] = $local_cObj->cObjGetSingle($this->conf['settings.']['fields.'][$key], $this->conf['settings.']['fields.'][$key . '.']); } } $typolink_conf = array(); $minicartMarkerArray['###MINICART_LINK###'] = $this->pi_linkToPage($this->pi_getLL('wtcart_ll_link'), $pid, "", $typolink_conf); $minicartMarkerArray['###MINICART_LINK_URL###'] = $this->pi_getPageLink($pid, "", $typolink_conf); $this->content = $this->cObj->substituteMarkerArrayCached($this->tmpl['minicart'], $minicartMarkerArray); // Get html template $this->content = $this->dynamicMarkers->main($this->content, $this); // Fill dynamic locallang or typoscript markers //$this->content = preg_replace('|###.*?###|i', '', $this->content); // Finally clear not filled markers } else { $this->content = $this->cObj->substituteMarkerArrayCached($this->tmpl['minicart_empty'], null, $minicartMarkerArray); // Get html template $this->content = $this->dynamicMarkers->main($this->content, $this); } return $this->pi_wrapInBaseClass($this->content); }
/** * Checks a given element if it complies with certain rules provided as a regular expression. * This function prepares all the information which is needed to check rules compliance, the * check itself will be carried out by checkRulesForElement () which calls itself recursively. * * Note that only few functionality of the POSIX standard for regular expressions is being supported, * see the manual for more details. * * @param string $rules: A regular expression describing the rule. The content elements are reflected by certain tokens (i.e. uppercase and lowercase characters). These tokens are also called "ruleConstants". * @param array $ruleConstants: An array with the mapping of tokens to content elements. * @param array $elArray: * @return array Array containing status information if the check was successful. * @access public * @see checkRulesForElement() */ function evaluateRulesForElement ($table, $uid) { $statusArr = array(); // Getting data structure for the template and extract information for default records to create $parentRecord = t3lib_BEfunc::getRecord ($table, $uid); // Only care about page records or flexible content elements: if ($table != 'tt_content' || $parentRecord['CType'] == 'templavoila_pi1') { $recRow = t3lib_BEfunc::getRecord ('tx_templavoila_datastructure', $parentRecord['tx_templavoila_ds']); $xmlContent = t3lib_div::xml2array($recRow['dataprot']); if (is_array($xmlContent['ROOT']) && is_array($xmlContent['ROOT']['el'])) { foreach ($xmlContent['ROOT']['el'] as $fieldName=>$field) { $ruleRegEx = trim ($field['tx_templavoila']['ruleRegEx']); $ruleConstants = trim ($field['tx_templavoila']['ruleConstants']); if ((string)$ruleRegEx != '' && ($field['tx_templavoila']['eType'] == 'ce')) { // only check if necessary // Save record of parent element for error tracking $this->lastParsedRecord = $parentRecord; $this->currentFieldName = $fieldName; // Get child records of the parent element record $childRecords = array (); $xmlContent = t3lib_div::xml2array($parentRecord['tx_templavoila_flex']); $recUIDs = t3lib_div::trimExplode(',',$xmlContent['data']['sDEF']['lDEF'][$fieldName]['vDEF']); foreach ($recUIDs as $recUID) { $row = t3lib_BEfunc::getRecord('tt_content', $recUID, 'uid,CType,tx_templavoila_to'); if ($row['CType'] == 'templavoila_pi1') { $row['CType'] .= ',' . $row['tx_templavoila_to']; } if (is_array ($row)) { // only would be no array if the row has been deleted somewhere else and still remains in the flexform data $childRecords[] = $row; } } // Check the rules: $tmpStatusArr = $this->checkRulesForElement ($ruleRegEx, $ruleConstants, $childRecords); $this->statusMerge($statusArr, $tmpStatusArr, true); } } } } #debug ($statusArr,'statusArr',__LINE__,__FILE__); return $statusArr; }
/** * Load a flexform in memory * * @param mixed $flexForm can be an xml string or an array or a key array. * @param string $flexFormName (optinal) give a name to the flexform in order to be stored for further use. * @return void */ function load($flexForm, $flexFormName = '') { //handle the case $flexForm is a string. It can be a xml string or key array if (is_string($flexForm)) { //test if $flexForm already exists in the memory. In this case load the flexform according to its key if (array_key_exists($flexForm, tx_div2007_ff::$flexForms)) { self::$flexForm = tx_div2007_ff::$flexForms[$flexForm]; } else { //if false, it means it is *still* a string to convert in an array self::$flexForm = t3lib_div::xml2array($flexForm); } } else { //else it is right away an array, load it in memory self::$flexForm = $flexForm; } //true when the flexform is going to be stored for further use if ($flexFormName != '') { self::setFlexForm($flexFormName, self::$flexForm); } }
/** * Returns information about this extension's pi1 plugin * * @param array $params Parameters to the hook * @param object $pObj A reference to calling object * @return string Information about pi1 plugin */ function getExtensionSummary($params, &$pObj) { if ($params['row']['list_type'] == 'imagecarousel_pi1') { $result = null; $data = t3lib_div::xml2array($params['row']['pi_flexform']); if (is_array($data)) { $skin = $data['data']['control']['lDEF']['skin']['vDEF'] ? $data['data']['control']['lDEF']['skin']['vDEF'] : $GLOBALS['LANG']->sL('LLL:EXT:imagecarousel/locallang.xml:cms_layout.from_ts'); $direction = $data['data']['control']['lDEF']['vertical']['vDEF'] ? $GLOBALS['LANG']->sL('LLL:EXT:imagecarousel/locallang.xml:cms_layout.vertical') : $GLOBALS['LANG']->sL('LLL:EXT:imagecarousel/locallang.xml:cms_layout.horizontal'); $result = sprintf($GLOBALS['LANG']->sL('LLL:EXT:imagecarousel/locallang.xml:cms_layout.style'), '<strong>' . ($skin ? $skin : $GLOBALS['LANG']->sL('LLL:EXT:imagecarousel/locallang.xml:cms_layout.from_ts')) . '</strong>', '<strong>' . $direction . '</strong>') . '<br/>'; /* $mode = $data['data']['general']['lDEF']['mode']['vDEF']; switch ($mode) { case 'upload' : { $images = t3lib_div::trimExplode(',', $data['data']['general']['lDEF']['images']['vDEF'], true); foreach ($images as $image) { $result .= t3lib_BEfunc::getThumbNail($GLOBALS['BACK_PATH'].'thumbs.php', PATH_site.'uploads/tx_imagecarousel/'.$image, '', ''); } break; } case 'dam' : { $result .= 'dam'; break; } case 'dam_catedit' : { $result .= 'dam_catedit'; break; } } $result .= '<br/>'; */ } else { $result = $GLOBALS['LANG']->sL('LLL:EXT:imagecarousel/locallang.xml:cms_layout.not_configured') . '<br/>'; } } elseif ($params['row']['list_type'] == 'imagecarousel_pi2') { $result = sprintf($GLOBALS['LANG']->sL('LLL:EXT:imagecarousel/locallang.xml:cms_layout.cloud'), '<strong>Cloud-Carousel</strong>') . '<br/>'; } if (t3lib_extMgm::isLoaded("templavoila")) { $result = strip_tags($result); } return $result; }
public function getContentFromTemplavoilaField($content, $conf) { $pageID = $this->cObj->stdWrap($conf['pageID'], $conf['pageID.']); $field = $this->cObj->stdWrap($conf['field'], $conf['field.']); $row = NULL; if ($GLOBALS['TSFE']->sys_language_content) { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages_language_overlay', 'deleted=0 AND hidden=0 AND pid=' . intval($pageID) . ' AND sys_language_uid=' . $GLOBALS['TSFE']->sys_language_content, '', '', 1); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); } if (!is_array($row)) { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'deleted=0 AND hidden=0 AND uid=' . intval($pageID), '', '', 1); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); } if (is_array($row)) { foreach ($row as $key => $val) { $GLOBALS['TSFE']->register['page_' . $key] = $val; } } $page_flex_array = t3lib_div::xml2array($row['tx_templavoila_flex']); $content_ids = array(); if (isset($page_flex_array['data'])) { if (isset($page_flex_array['data']['sDEF'])) { if (count($page_flex_array['data']['sDEF']['lDEF']) > 0) { foreach ($page_flex_array['data']['sDEF']['lDEF'] as $key => $fields) { if ($key == $field) { $content_ids = array_merge($content_ids, t3lib_div::trimExplode(',', $fields['vDEF'])); } } } } } $content = NULL; foreach ($content_ids as $content_id) { $GLOBALS['TSFE']->register['uid'] = $content_id; $content .= $this->cObj->cObjGetSingle($conf['contentRender'], $conf['contentRender.']); } return $content; }
/** * check if wt_gallery is loaded and used on current page in current language * * @return boolean true/false */ function user_wtgallery_oncurrentpage() { // config $languid = intval($GLOBALS['TSFE']->tmpl->setup['config.']['sys_language_uid']) > 0 ? $GLOBALS['TSFE']->tmpl->setup['config.']['sys_language_uid'] : 0; // current language uid $i = 0; $found = 0; // let's go // 1. check if plugin is on current page in current lang $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tt_content.pi_flexform', 'tt_content', $where_clause = 'pid = ' . intval($GLOBALS['TSFE']->id) . ' AND sys_language_uid = ' . $languid . ' AND deleted = 0 AND hidden = 0', $groupBy = '', $orderBy = '', $limit = '1'); if ($res) { // If there is a result while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { // One loop for wt_gallery entry on current page in current lang if ($row['pi_flexform']) { // if there are values in the flexform $flexform_arr = t3lib_div::xml2array($row['pi_flexform']); // change xml to an array $mode_str = $flexform_arr['data']['main']['lDEF']['mode']['vDEF']; // get mode of entry $mode = t3lib_div::trimExplode(',', $mode_str, 1); // change mode to an array if (in_array('cooliris', $mode)) { $found = 1; } // found something $i++; // increase counter } } } if ($found == 1) { return true; } else { return false; } }
/** * This will render the field "meta" as table from it's xml content which has eg. EXIF data in it. * * @param array $PA An array with additional configuration options. * @param object $fobj TCEForms object reference * @return string The HTML code for the TCEform field */ function tx_dam_meta($PA, &$fobj) { global $TYPO3_CONF_VARS; // description of exif data $metaDesc['EXIF']['ExposureMode'] = array('Auto Exposure', 'Manual Exposure', 'Auto bracket'); $metaDesc['EXIF']['MeteringMode'] = array('unknown', 'Average', 'CenterWeightedAverage', 'Spot', 'MultiSpot', 'Pattern', 'Partial'); $metaDesc['EXIF']['SensingMethod'] = array('', 'Not defined', 'One-chip color area sensor', 'Two-chip color area sensor', 'Three-chip color area sensor', 'Color sequential area sensor', 'Trilinear sensor', 'Color sequential linear sensor'); $metaDesc['EXIF']['SubjectDistanceRange'] = array('unknown', 'Macro', 'Close view', 'Distant view'); $metaDesc['EXIF']['ExposureProgram'] = array('Not defined', 'Manual', 'Normal program', 'Aperture priority', 'Shutter priority', 'Creative program', 'Action program', 'Portrait mode', 'Landscape mode'); $this->tceforms =& $PA['pObj']; // Init: $config = $PA['fieldConf']['config']; $config['pass_content'] = true; $config['fixedRows'] = true; $wantedCharset = $TYPO3_CONF_VARS['BE']['forceCharset'] ? $TYPO3_CONF_VARS['BE']['forceCharset'] : 'iso-8859-1'; if (!$wantedCharset === 'utf-8') { $csConvObj = t3lib_div::makeInstance('t3lib_cs'); } $data = t3lib_div::xml2array($PA['itemFormElValue']); $content = ''; if (is_array($data)) { foreach ($data as $key => $value) { if (is_array($value) and count($value) and !isset($value['xml'])) { // skip raw xml // convert pure data to human readable if (is_array($metaDesc[$key])) { // exif, iptc foreach ($value as $dataKey => $dataVal) { $key = strtoupper($key); if (is_array($metaDesc[$key][$dataKey])) { // description found? $value[$dataKey] = $metaDesc[$key][$dataKey][$dataVal]; // apply } } } $content .= '<h4>' . strtoupper($key) . '</h4>'; if (is_object($csConvObj)) { $csConvObj->convArray($value, 'utf-8', $wantedCharset); } $content .= $this->array2table($value); } } } else { // if decoding went wrong just show the content $content = nl2br(htmlspecialchars($PA['itemFormElValue'])); } return $this->tceforms->getSingleField_typeNone_render($config, $content); }
/** * Constructor - set the values from database row. * * @param array $arRow Database context row * * @return void */ public function __construct($arRow = array()) { //check TSFE is set //prevent Exceptions in eID $this->initTsfe(); if (!empty($arRow)) { $this->uid = (int) $arRow['uid']; $this->type = $arRow['type']; $this->title = $arRow['title']; $this->alias = $arRow['alias']; $this->tstamp = $arRow['tstamp']; $this->invert = $arRow['invert']; $this->use_session = $arRow['use_session']; $this->disabled = $arRow['disabled']; $this->bHideInBackend = (bool) $arRow['hide_in_backend']; if ($arRow['type_conf'] != '') { $this->conf = t3lib_div::xml2array($arRow['type_conf']); } } }
function setSelectedItems() { $selectedItems = array(); if (isset($this->row[$this->field])) { $selectedItems = t3lib_div::trimExplode(',', $this->row[$this->field], 1); } else { if ($this->table == 'tt_content' and $this->row['pi_flexform']) { $xmlArray = t3lib_div::xml2array($this->row['pi_flexform']); $selectedItems = t3lib_div::trimExplode(',', $xmlArray['data'][$this->fieldConfig['piFlexFormSheet']][$this->fieldConfig['piFlexFormLang']][$this->field][$this->fieldConfig['piFlexFormValue']], 1); } } foreach ($selectedItems as $item) { $item = t3lib_div::trimExplode('|', $item, 1); $this->selectedItems[] = $item[0]; } }
/** * Reading database structure * * @return void */ function xmlDB_readStructure() { $this->DBstructure = t3lib_div::xml2array(t3lib_div::getUrl($this->DBdir . '_STRUCTURE.xml')); }
/** * Returns the configuration of jQuery Bootstrap * @return array */ function getJqueryBootstrapConfiguration($version = NULL) { if ($version === NULL) { $confArr = tx_t3jquery::getConf(); $version = $confArr['jQueryBootstrapVersion']; } $configuration = t3lib_div::xml2array(t3lib_div::getUrl(t3lib_div::getFileAbsFileName('EXT:t3jquery/res/jquery/bootstrap/' . $version . '/jquery.xml'))); return $configuration; }
/** * Converts a given config in Flexform to a conf-array * @param string Flexform data * @param array array to write the data into, by reference * @param boolean is set if called recursive. Don't call function with this parameter, it's used inside the function only * @access public * */ public function readFlexformIntoConf($flexData, &$conf, $recursive = FALSE) { if ($recursive === FALSE) { $flexData = t3lib_div::xml2array($flexData, 'T3'); } if (is_array($flexData)) { if (isset($flexData['data']['sDEF']['lDEF'])) { $flexData = $flexData['data']['sDEF']['lDEF']; } foreach ($flexData as $key => $value) { if (is_array($value['el']) && count($value['el']) > 0) { foreach ($value['el'] as $ekey => $element) { if (isset($element['vDEF'])) { $conf[$ekey] = $element['vDEF']; } else { if (is_array($element)) { $this->readFlexformIntoConf($element, $conf[$key][key($element)][$ekey], TRUE); } else { $this->readFlexformIntoConf($element, $conf[$key][$ekey], TRUE); } } } } else { $this->readFlexformIntoConf($value['el'], $conf[$key], TRUE); } if ($value['vDEF']) { $conf[$key] = $value['vDEF']; } } } }
/** * Processing of the data value in case the field type is "flex" * MUST NOT be called in case of already INSIDE a flexform! * * @param string The field value * @param array TCA field config * @param array TCEform TSconfig for the record * @param string Table name * @param array The row * @param string Field name * @return string The processed input field value ($data) * @access private * @see renderRecord() */ function renderRecord_flexProc($data, $fieldConfig, $TSconfig, $table, $row, $field) { global $TCA; // Convert the XML data to PHP array: $currentValueArray = t3lib_div::xml2array($data); if (is_array($currentValueArray)) { // Get current value array: $dataStructArray = t3lib_BEfunc::getFlexFormDS($fieldConfig['config'], $row, $table); // Manipulate Flexform DS via TSConfig and group access lists if (is_array($dataStructArray)) { $flexFormHelper = t3lib_div::makeInstance('t3lib_TCEforms_Flexforms'); $dataStructArray = $flexFormHelper->modifyFlexFormDS($dataStructArray, $table, $field, $row, $fieldConfig); unset($flexFormHelper); } if (is_array($dataStructArray)) { $currentValueArray['data'] = $this->renderRecord_flexProc_procInData($currentValueArray['data'], $dataStructArray, array($data, $fieldConfig, $TSconfig, $table, $row, $field)); $flexObj = t3lib_div::makeInstance('t3lib_flexformtools'); $data = $flexObj->flexArray2Xml($currentValueArray, TRUE); } } return $data; }
/** * Retourne un tableau contenant la configuration flexform du plugin coté Backend. * Le tableau organise les éléments sous la forme "key" => "value" * @param String $xml_flexform : information de la base flexform * Si null alors on retourne le flexform du plugin * @return array $lConf */ private function getPIValues($xml_flexform = null) { if ($xml_flexform != null) { $piFlexForm = t3lib_div::xml2array($xml_flexform); } else { $this->pi_initPIflexform(); $piFlexForm = $this->cObj->data['pi_flexform']; //Zend_Debug::dump($piFlexForm); } $lConf = array(); // Setup our storage array... foreach ($piFlexForm['data'] as $sheet => $data) { foreach ($data as $lang => $value) { foreach ($value as $key => $val) { if (is_array($val)) { // SI VRAI if (array_key_exists("_TRANSFORM_vDEF.vDEFbase", $val)) { $lConf[$key] = $val["_TRANSFORM_vDEF.vDEFbase"]; } else { $lConf[$key] = $val["vDEF"]; } // Ne gère pas les balises p } else { $lConf[$key] = $this->pi_getFFvalue($piFlexForm, $key, $sheet); } } } } return $lConf; }
/** * [Describe function...] * * @return [type] ... */ function setSelectedItems() { if ($this->table == 'tt_content') { if ($this->row['pi_flexform']) { $cfgArr = t3lib_div::xml2array($this->row['pi_flexform']); if (is_array($cfgArr) && is_array($cfgArr['data']['sDEF']['lDEF']) && is_array($cfgArr['data']['sDEF']['lDEF']['categorySelection'])) { $selectedCategories = $cfgArr['data']['sDEF']['lDEF']['categorySelection']['vDEF']; } } } else { $selectedCategories = $this->row[$this->field]; } if ($selectedCategories) { $selvals = explode(',', $selectedCategories); if (is_array($selvals)) { foreach ($selvals as $vv) { $cuid = explode('|', $vv); $this->selectedItems[] = $cuid[0]; } } } }
/** * Action that displays a single TwitterFeed */ public function showAction() { //die(print_r($this->twitterFeedRepository->findByAccountName('remco'),true)); $ffdata = $this->request->getContentObjectData(); $options = t3lib_div::xml2array($ffdata['pi_flexform']); $displayFeed = $options['data']['sDEF']['lDEF']['displayFeed']['vDEF']; $twitterFeed = $this->twitterFeedRepository->findByUid($displayFeed); $account = $twitterFeed->getAccount(); if ($account->getUserToken() == null || $account->getUserSecret == null) { die('You need to add a twitter authorization token/secret to the database manually for now.'); } /* $feed = curl_init("http://twitter.com/statuses/user_timeline/19768085.json?count=20"); curl_setopt($feed,CURLOPT_RETURNTRANSFER,true); $data = curl_exec($feed); $data = json_decode($data,true); //var_dump($data); curl_close($feed); */ $req_url = 'http://api.twitter.com/oauth/request_token'; $authurl = 'https://api.twitter.com/oauth/authorize'; $acc_url = 'https://api.twitter.com/oauth/access_token'; $api_url = 'https://api.twitter.com'; $args = $this->request->getArguments(); if (isset($args['feed'])) { switch ($args['feed']) { case 1: $fid = 1; $title = "My"; $getfeed = $api_url . "/1/statuses/user_timeline.json"; break; case 2: $fid = 2; $title = "My Friends"; $getfeed = $api_url . "/1/statuses/home_timeline.json"; break; case 3: $fid = 3; $title = "Other Peoples"; $getfeed = $api_url . "/1/statuses/public_timeline.json"; break; case 4: $fid = 4; $title = "Search for 'remco'"; $getfeed = "http://search.twitter.com/search.json?q=remco"; break; } } else { $title = "My"; $getfeed = $api_url . "/1/statuses/user_timeline.json"; $fid = 1; } $json = apc_fetch("tx_twitterFeed_{$twitterFeed->getFeedName()}_JSON{$fid}"); if ($json === FALSE) { try { $oauth = new OAuth($this->settings['consumerKey'], $this->settings['consumerSecret'], OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_AUTHORIZATION); $oauth->setToken($account->getUserToken(), $account->getUserSecret()); $oauth->fetch($getfeed, null, OAUTH_HTTP_METHOD_GET); $json = json_decode($oauth->getLastResponse(), true); apc_store("tx_twitterFeed_{$twitterFeed->getFeedName()}_JSON{$fid}", $json, 60 * 5); $status = "fetched from Twitter using OAUTH/GET/JSON and put in the APC cache afterwards"; } catch (OAuthException $e) { $this->flashMessages->add($e->getMessage()); $status = "cat /proc/status > /dev/null"; } } else { $status = "from APC cached JSON"; } //if($fid==4) print_r($json); $this->response->addAdditionalHeaderData("<script src=\"http://platform.twitter.com/anywhere.js?id={$this->settings['anywhereAPIKey']}&v=1\" type=\"text/javascript\"></script>"); $this->view->assign('twitterFeed', $twitterFeed); $this->view->assign('data', $json); $this->view->assign('status', $status); $this->view->assign('title', $title); }
/** * Creates language-overlay for records in general (where translation is found in records from the same table) * * @param string Table name * @param array Record to overlay. Must containt uid, pid and $table]['ctrl']['languageField'] * @param integer Pointer to the sys_language uid for content on the site. * @param string Overlay mode. If "hideNonTranslated" then records without translation will not be returned un-translated but unset (and return value is false) * @return mixed Returns the input record, possibly overlaid with a translation. But if $OLmode is "hideNonTranslated" then it will return false if no translation is found. */ function getRecordOverlay($table, $row, $sys_language_content, $OLmode = '') { //echo $table.'--'.$row['uid'].'--'.$sys_language_content.'--'.$OLmode; //echo '<hr>'; //return parent::getRecordOverlay($table,$row,$sys_language_content,$OLmode); global $TCA; //echo $row['uid'].'-'; //39348 //unset olmode $OLmode = ''; // die('���'); //call service to know if element is visible and which overlay language to use try { $element = tx_languagevisibility_feservices::getElement($row['uid'], $table); $overlayLanguage = tx_languagevisibility_feservices::getOverlayLanguageIdForElement($element, $sys_language_content); } catch (Exception $e) { //for any other tables: return parent::getRecordOverlay($table, $row, $sys_language_content, $OLmode); } //debug($overlayLanguage); if ($overlayLanguage === false) { //echo 'unset '.$table.' / '.$row['uid']; //not visible: unset($row); return $row; } else { //visible: if ($overlayLanguage != 0) { if ($element instanceof tx_languagevisibility_fceelement) { //for FCE the overlay processing is handled by templavoila module, so mark the row with additional infos: $languageRep = t3lib_div::makeInstance('tx_languagevisibility_languagerepository'); $overlayLanguageObj = $languageRep->getLanguageById($overlayLanguage); $row['_OVERLAYLANGUAGEISOCODE'] = $overlayLanguageObj->getIsoCode(); return $row; } elseif ($element instanceof tx_languagevisibility_fceoverlayelement) { //now its getting tricky: we need to return overlay record with merged XML $olrow = $this->_getDatabaseTranslationOverlayRecord('tt_content', $row, $overlayLanguage); if ($GLOBALS['TSFE']) { $GLOBALS['TSFE']->includeTCA('tt_content'); } //parse fce xml, and where a xml field is empty in olrow -> use default one $flexObj = t3lib_div::makeInstance('t3lib_flexformtools'); $this->_callbackVar_defaultXML = t3lib_div::xml2array($row['tx_templavoila_flex']); $this->_callbackVar_overlayXML = t3lib_div::xml2array($olrow['tx_templavoila_flex']); if (!is_array($this->_callbackVar_overlayXML)) { $this->_callbackVar_overlayXML = array(); } $return = $flexObj->traverseFlexFormXMLData('tt_content', 'tx_templavoila_flex', $row, $this, '_callback_checkXMLFieldsForFallback'); $row = parent::getRecordOverlay($table, $row, $overlayLanguage, $OLmode); $row['tx_templavoila_flex'] = t3lib_div::array2xml($this->_callbackVar_overlayXML); return $row; } else { //for default elements just do TYPO3 default overlay return parent::getRecordOverlay($table, $row, $overlayLanguage, $OLmode); } } else { return $row; } } }