コード例 #1
0
    /**
     * Testing soft reference parsers on content
     *
     * @return	string		HTML content
     */
    function calc_softref()
    {
        // Render input form:
        $content = '
			<h3>Input values to run soft reference parsers on:</h3>' . 'Input the content to parse:<br/>
				<textarea rows="10" name="inputCalc[softref][input]" wrap="off"' . $GLOBALS['TBE_TEMPLATE']->formWidthText(48, 'width:98%;', 'off') . '>' . t3lib_div::formatForTextarea($this->inputCalc['softref']['input']) . '</textarea>' . '<br/>Input parser keys to test: <br/>
				<input name="inputCalc[softref][parsers]" value="' . htmlspecialchars($this->inputCalc['softref']['parsers'] ? $this->inputCalc['softref']['parsers'] : implode(',', array_keys($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['softRefParser']))) . '" type="text" /><br/>
				<input type="submit" name="cmd[softref]" value="Test" />
		';
        if ($this->cmd == 'softref' && trim($this->inputCalc['softref']['input'])) {
            $value = $this->inputCalc['softref']['input'];
            $table = '_TABLE';
            $field = '_FIELD_';
            $uid = '_UID_';
            // Soft References:
            if (strlen($value) && ($softRefs = t3lib_BEfunc::explodeSoftRefParserList($this->inputCalc['softref']['parsers']))) {
                $softRefValue = $value;
                foreach ($softRefs as $spKey => $spParams) {
                    $softRefObj =& t3lib_BEfunc::softRefParserObj($spKey);
                    if (is_object($softRefObj)) {
                        $resultArray = $softRefObj->findRef($table, $field, $uid, $softRefValue, $spKey, $spParams);
                        if (is_array($resultArray)) {
                            $outRow[$field]['softrefs']['keys'][$spKey] = $resultArray['elements'];
                            if (strlen($resultArray['content'])) {
                                $softRefValue = $resultArray['content'];
                            }
                        }
                    }
                }
                if (is_array($outRow[$field]['softrefs']) && count($outRow[$field]['softrefs']) && strcmp($value, $softRefValue) && strstr($softRefValue, '{softref:')) {
                    $outRow[$field]['softrefs']['tokenizedContent'] = $softRefValue;
                }
            }
            $content .= Tx_Extdeveval_Compatibility::viewArray($outRow);
        }
        return $content;
    }
コード例 #2
0
 /**
  * Find all supported broken links for a specific record.
  *
  * @param	array		$results: array of broken links
  * @param	string		$table: table name of the record
  * @param	array		$fields: array of fields to analyze
  * @param	array		$record: record to analyse
  * @return	void
  */
 public function analyzeRecord(&$results, $table, $fields, $record)
 {
     // array to store urls from relevant field contents
     $urls = array();
     $referencedRecordType = '';
     // last-parsed link element was a page.
     $wasPage = TRUE;
     // flag whether row contains a broken link in some field or not
     $rowContainsBrokenLink = FALSE;
     // put together content of all relevant fields
     $haystack = '';
     $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
     $idRecord = $record['uid'];
     // get all references
     foreach ($fields as $field) {
         $haystack .= $record[$field] . ' --- ';
         $conf = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
         $valueField = $record[$field];
         // Check if a TCA configured field has softreferences defined (see TYPO3 Core API document)
         if ($conf['softref'] && strlen($valueField)) {
             // Explode the list of softreferences/parameters
             $softRefs = t3lib_BEfunc::explodeSoftRefParserList($conf['softref']);
             // Traverse soft references
             foreach ($softRefs as $spKey => $spParams) {
                 // create / get object
                 $softRefObj =& t3lib_BEfunc::softRefParserObj($spKey);
                 // If there was an object returned...:
                 if (is_object($softRefObj)) {
                     // Do processing
                     $resultArray = $softRefObj->findRef($table, $field, $idRecord, $valueField, $spKey, $spParams);
                     if (!empty($resultArray['elements'])) {
                         if ($spKey == 'typolink_tag') {
                             $this->analyseTypoLinks($resultArray, $results, $htmlParser, $record, $field, $table);
                         } else {
                             $this->analyseLinks($resultArray, $results, $record, $field, $table);
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #3
0
 /**
  * Callback function for traversing the FlexForm structure in relation to finding file and DB references!
  *
  * @param	array		Data structure for the current value
  * @param	mixed		Current value
  * @param	array		Additional configuration used in calling function
  * @param	string		Path of value in DS structure
  * @param	object		Object reference to caller
  * @return	void
  * @see t3lib_TCEmain::checkValue_flex_procInData_travDS()
  */
 function getRelations_flexFormCallBack($dsArr, $dataValue, $PA, $structurePath, $pObj)
 {
     $structurePath = substr($structurePath, 5) . '/';
     // removing "data/" in the beginning of path (which points to location in data array)
     $dsConf = $dsArr['TCEforms']['config'];
     // Implode parameter values:
     list($table, $uid, $field) = array($PA['table'], $PA['uid'], $PA['field']);
     // Add files
     if ($result = $this->getRelations_procFiles($dataValue, $dsConf, $uid)) {
         // Creates an entry for the field with all the files:
         $this->temp_flexRelations['file'][$structurePath] = $result;
     }
     // Add DB:
     if ($result = $this->getRelations_procDB($dataValue, $dsConf, $uid)) {
         // Create an entry for the field with all DB relations:
         $this->temp_flexRelations['db'][$structurePath] = $result;
     }
     // Soft References:
     if (strlen($dataValue) && ($softRefs = t3lib_BEfunc::explodeSoftRefParserList($dsConf['softref']))) {
         $softRefValue = $dataValue;
         foreach ($softRefs as $spKey => $spParams) {
             $softRefObj = t3lib_BEfunc::softRefParserObj($spKey);
             if (is_object($softRefObj)) {
                 $resultArray = $softRefObj->findRef($table, $field, $uid, $softRefValue, $spKey, $spParams, $structurePath);
                 if (is_array($resultArray) && is_array($resultArray['elements'])) {
                     $this->temp_flexRelations['softrefs'][$structurePath]['keys'][$spKey] = $resultArray['elements'];
                     if (strlen($resultArray['content'])) {
                         $softRefValue = $resultArray['content'];
                     }
                 }
             }
         }
         if (count($this->temp_flexRelations['softrefs']) && strcmp($dataValue, $softRefValue)) {
             $this->temp_flexRelations['softrefs'][$structurePath]['tokenizedContent'] = $softRefValue;
         }
     }
 }