本文整理汇总了PHP中TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::parse方法的典型用法代码示例。如果您正苦于以下问题:PHP TypoScriptParser::parse方法的具体用法?PHP TypoScriptParser::parse怎么用?PHP TypoScriptParser::parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser
的用法示例。
在下文中一共展示了TypoScriptParser::parse方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup
/**
* Setup test by loading some demo ts settings
*/
public function setup()
{
$this->tsConfigString = "plugin.tx_ptextlist.settings {\n\t\t\t\n\t\t\t prototype {\n\t\t\t \n\t\t\t pager.pagerConfigs.default.pagerClassName = Tx_PtExtlist_Domain_Model_Pager_DefaultPager\n\t \t\t\t pager.pagerConfigs.default.enabled = 1\n\t \t\t\t pager.pagerConfigs.default.templatePath = EXT:pt_extlist/\n\t\t\t \n\t\t\t }\n\t\t\t\n\t\t\t # This comes from flexform!\n\t\t\t listIdentifier = list1\n\t\t\t\n\t\t\t listConfig.list1 {\n\t\t\t \n\t\t\t backendConfig {\n\t\t\t\n\t\t\t dataBackendClass = Tx_PtExtlist_Domain_DataBackend_MySqlDataBackend_MySqlDataBackend\n\t\t\t dataSourceClass = Tx_PtExtlist_Domain_DataBackend_DataSource_Typo3DataSource\n\t\t\t dataMapperClass = Tx_PtExtlist_Domain_DataBackend_Mapper_ArrayMapper\n\t\t\t queryInterpreterClass = Tx_PtExtlist_Domain_DataBackend_MySqlDataBackend_MySqlInterpreter_MySqlInterpreter\n\t\t\t \n\t\t\t datasource {\n\t\t\t host = " . TYPO3_db_host . "\n\t\t\t username = " . TYPO3_db_username . "\n\t\t\t password = " . TYPO3_db_password . "\n\t\t\t database = " . TYPO3_db . "\n\t\t\t }\n\t\t\t \n\t\t\t tables (\n\t\t\t static_countries, \n\t\t\t static_territories st_continent, \n\t\t\t static_territories st_subcontinent\n\t\t\t )\n\t\t\t \n\t\t\t baseFromClause (\n\t\t\t )\n\t\t\t \n\t\t\t baseWhereClause (\n\t\t\t ) \n\t\t\t \n\t\t\t useEnableFields = 1\n\t\t\t \n\t\t\t }\n\t\t\t \n\t\t\t fields {\n\t\t\t \tfieldIndentifier1 {\n\t\t\t \t\ttable = table1\n\t\t\t \t\tfield = field1\n\t\t\t \t}\n\t\t\t }\n\t\t\t }\n\t\t\t}";
$this->typoScriptParser = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
$this->typoScriptParser->parse($this->tsConfigString);
$this->tsConfig = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Service\\TypoScriptService')->convertTypoScriptArrayToPlainArray($this->typoScriptParser->setup);
$this->configurationBuilder = new Tx_PtExtlist_Domain_Configuration_ConfigurationBuilder($this->tsConfig['plugin']['tx_ptextlist']['settings'], 'list1');
}
示例2: scriptParser
/**
* Parse, and return conf - array
*
* @param string $script
* @param int $recursiveLevel
* @return array TypoScript configuration array
*/
protected function scriptParser($script = '', $recursiveLevel)
{
$script = $this->parser->checkIncludeLines($script);
// get constants
$this->parser->parse(implode(PHP_EOL, $GLOBALS['TSFE']->tmpl->constants), $this->matchCondition);
// recursive substitution of constants
for ($i = 0; $i < $recursiveLevel; $i++) {
$oldScript = $script;
$script = preg_replace_callback('/\\{\\$(.[^}]*)\\}/', array($this, 'substituteConstantsCallBack'), $script);
if ($oldScript == $script) {
break;
}
}
foreach ($GLOBALS['TSFE']->tmpl->setup as $tsObjectKey => $tsObjectValue) {
if ($tsObjectKey !== intval($tsObjectKey, 10)) {
$this->parser->setup[$tsObjectKey] = $tsObjectValue;
}
}
$this->parser->parse($script, $this->matchCondition);
return $this->parser->setup;
}
示例3: renderField
/**
* Render a Flexible Content Element type selection field
*
* @param array $parameters
* @param mixed $parentObject
* @return string
*/
public function renderField(array &$parameters, &$parentObject)
{
/** @var \TYPO3\CMS\Core\Cache\CacheManager $cacheManager */
$cacheManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager')->get('TYPO3\\CMS\\Core\\Cache\\CacheManager');
/** @var StringFrontend $cache */
$cache = $cacheManager->getCache('fluidcontent');
$pageTypoScript = TRUE === $cache->has('pageTsConfig') ? $cache->get('pageTsConfig') : array();
$tsParser = new TypoScriptParser();
$conditions = new ConditionMatcher();
$pageUid = GeneralUtility::_GET('id');
$pageUid = intval($pageUid);
if (0 === $pageUid) {
$pageUid = intval($parameters['row']['pid']);
}
$conditions->setPageId($pageUid);
$tsParser->parse($pageTypoScript, $conditions);
$setup = $tsParser->setup['mod.']['wizards.']['newContentElement.']['wizardItems.'];
if (FALSE === is_array($setup)) {
return LocalizationUtility::translate('pages.no_content_types', 'Fluidcontent');
}
$setup = GeneralUtility::removeDotsFromTS($setup);
$name = $parameters['itemFormElName'];
$value = $parameters['itemFormElValue'];
$select = '<div><select name="' . htmlspecialchars($name) . '" class="formField select" onchange="if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };">' . LF;
$select .= '<option value="">' . $GLOBALS['LANG']->sL('LLL:EXT:fluidcontent/Resources/Private/Language/locallang.xml:tt_content.tx_fed_fcefile', TRUE) . '</option>' . LF;
foreach ($setup as $groupLabel => $configuration) {
$select .= '<optgroup label="' . htmlspecialchars($groupLabel) . '">' . LF;
foreach ($configuration['elements'] as $elementConfiguration) {
$optionValue = $elementConfiguration['tt_content_defValues']['tx_fed_fcefile'];
$selected = $optionValue === $value ? ' selected="selected"' : '';
$label = $elementConfiguration['title'];
$label = $GLOBALS['LANG']->sL($label);
$select .= '<option value="' . htmlspecialchars($optionValue) . '"' . $selected . '>' . htmlspecialchars($label) . '</option>' . LF;
}
$select .= '</optgroup>' . LF;
}
$select .= '</select></div>' . LF;
unset($parentObject);
return $select;
}
示例4: typoScriptIsParsedToArray
/**
* @param string $typoScript
* @param array $expected
* @dataProvider typoScriptIsParsedToArrayDataProvider
* @test
*/
public function typoScriptIsParsedToArray($typoScript, array $expected)
{
$this->typoScriptParser->parse($typoScript);
$this->assertEquals($expected, $this->typoScriptParser->setup);
}
示例5: initialize
/**
* Initializes the cronjob.
* This function initializes the cronjob object. The initialization of a
* cronjob consists of:
*
* 1. Load the default settings from static constants
* 2. Load user settings from tx_mmforum_config.ts
* 3. Join default and user settings and parse into an array
* 4. Load language file for the cronjob
* 5. Validate settings and exit with error if something is missing
*
* @author Martin Helmich <m.helmich@mittwald.de>
* @version 2008-06-22
* @return void
*/
function initialize()
{
$this->MMFORUMPATH = ExtensionManagementUtility::extPath('mm_forum');
// Load default constants file
$conf = file_get_contents($this->MMFORUMPATH . 'ext_typoscript_constants.txt');
// Load user settings file
$localSettings_filename = PATH_typo3conf . 'tx_mmforum_config.ts';
if (file_exists($localSettings_filename)) {
$conf .= "\n#LOCAL SETTINGS\n" . file_get_contents($localSettings_filename);
}
// Parse setup
$parser = new TypoScriptParser();
$parser->parse($conf);
$this->conf = $parser->setup['plugin.']['tx_mmforum.'];
// Load language files
$this->loadLanguageFile();
// Validate configuration
$this->validateConfig();
}