本文整理汇总了PHP中t3lib_div::xml2array方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_div::xml2array方法的具体用法?PHP t3lib_div::xml2array怎么用?PHP t3lib_div::xml2array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_div
的用法示例。
在下文中一共展示了t3lib_div::xml2array方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTtContentRecordsWithT3sPlugin
/**
* 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();
}
示例2: user_rgslideshow
/**
* 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> ';
}
}
示例3: addFields_predefinedJS
/**
* 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;
}
示例4: getExtensionSummary
/**
* 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;
}
示例5: execute
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;
}
示例6: getFormFromFlexform
/**
* 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;
}
示例7: getLL
/**
* 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;
}
示例8: getPreviewData
/**
*
* @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;
}
示例9: readLLFile
/**
* 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'];
}
示例10: main
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;
}
示例11: getExtensionSummary
/**
* 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;
}
示例12: main
/**
* 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;
}
}
}
示例13: getExtensionSummary
/**
* 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;
}
示例14: main
/**
* 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);
}
示例15: evaluateRulesForElement
/**
* 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;
}