本文整理汇总了PHP中TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::checkIncludeLines方法的典型用法代码示例。如果您正苦于以下问题:PHP TypoScriptParser::checkIncludeLines方法的具体用法?PHP TypoScriptParser::checkIncludeLines怎么用?PHP TypoScriptParser::checkIncludeLines使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser
的用法示例。
在下文中一共展示了TypoScriptParser::checkIncludeLines方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: processIncludes
/**
* Searching TypoScript code text (for constants and config (Setup))
* for include instructions and does the inclusion of external TypoScript files
* if needed.
*
* @return void
* @see \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser, generateConfig()
*/
public function processIncludes()
{
if ($this->processIncludesHasBeenRun) {
return;
}
$paths = $this->templateIncludePaths;
$files = array();
foreach ($this->constants as &$value) {
$includeData = \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::checkIncludeLines($value, 1, TRUE, array_shift($paths));
$files = array_merge($files, $includeData['files']);
$value = $includeData['typoscript'];
}
unset($value);
$paths = $this->templateIncludePaths;
foreach ($this->config as &$value) {
$includeData = \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::checkIncludeLines($value, 1, TRUE, array_shift($paths));
$files = array_merge($files, $includeData['files']);
$value = $includeData['typoscript'];
}
unset($value);
if (!empty($files)) {
$files = array_unique($files);
foreach ($files as $file) {
$this->rowSum[] = array($file, filemtime($file));
}
}
$this->processIncludesHasBeenRun = TRUE;
}
示例3: processTemplateRowAfterLoading
/**
* Process template row after loading
*
* @param array $tplRow Template row
* @return array Preprocessed template row
*/
public function processTemplateRowAfterLoading(array $tplRow)
{
if ($this->pObj->MOD_SETTINGS['includeTypoScriptFileContent']) {
// Let the recursion detection counter start at 91, so that only 10 recursive calls will be resolved
// Otherwise the editor will be bloated with way to many lines making it hard the break the cyclic recursion.
$tplRow['config'] = TypoScriptParser::checkIncludeLines($tplRow['config'], 91);
$tplRow['constants'] = TypoScriptParser::checkIncludeLines($tplRow['constants'], 91);
}
return $tplRow;
}
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:16,代码来源:TypoScriptTemplateInformationModuleFunctionController.php
示例4: processIncludes
/**
* Searching TypoScript code text (for constants and config (Setup))
* for include instructions and does the inclusion of external TypoScript files
* if needed.
*
* @return void
* @see t3lib_TSparser, generateConfig()
*/
public function processIncludes()
{
$files = array();
foreach ($this->constants as &$value) {
$includeData = \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::checkIncludeLines($value, 1, TRUE);
$files = array_merge($files, $includeData['files']);
$value = $includeData['typoscript'];
}
unset($value);
foreach ($this->config as &$value) {
$includeData = \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::checkIncludeLines($value, 1, TRUE);
$files = array_merge($files, $includeData['files']);
$value = $includeData['typoscript'];
}
unset($value);
if (count($files)) {
$files = array_unique($files);
foreach ($files as $file) {
$this->rowSum[] = array($file, filemtime($file));
}
}
}
示例5: getStrategyConfig
/**
* @param $strategy
* @return array
*/
protected function getStrategyConfig($strategy)
{
if ($this->strategyConfig[$strategy['uid']] === NULL) {
$parseObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
$config = \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::checkIncludeLines($strategy['config']);
$parseObj->parse($config);
$config = $parseObj->setup;
$this->strategyConfig[$strategy['uid']] = $config;
}
return $this->strategyConfig[$strategy['uid']];
}
示例6: main
/**
* Main
*
* @return string
* @todo Define visibility
*/
public function main()
{
// Initializes the module. Done in this function because we may need to re-initialize if data is submitted!
// Checking for more than one template an if, set a menu...
$manyTemplatesMenu = $this->pObj->templateMenu();
$template_uid = 0;
if ($manyTemplatesMenu) {
$template_uid = $this->pObj->MOD_SETTINGS['templatesOnPage'];
}
// BUGBUG: Should we check if the uset may at all read and write template-records???
$existTemplate = $this->initialize_editor($this->pObj->id, $template_uid);
// initialize
if ($existTemplate) {
$theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('currentTemplate', TRUE), \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('sys_template', $GLOBALS['tplRow']) . '<strong>' . $this->pObj->linkWrapTemplateTitle($GLOBALS['tplRow']['title']) . '</strong>' . htmlspecialchars(trim($GLOBALS['tplRow']['sitetitle']) ? ' (' . $GLOBALS['tplRow']['sitetitle'] . ')' : ''));
}
if ($manyTemplatesMenu) {
$theOutput .= $this->pObj->doc->section('', $manyTemplatesMenu);
}
$GLOBALS['tmpl']->clearList_const_temp = array_flip($GLOBALS['tmpl']->clearList_const);
$GLOBALS['tmpl']->clearList_setup_temp = array_flip($GLOBALS['tmpl']->clearList_setup);
$pointer = count($GLOBALS['tmpl']->hierarchyInfo);
$GLOBALS['tmpl']->hierarchyInfoArr = $GLOBALS['tmpl']->ext_process_hierarchyInfo(array(), $pointer);
$GLOBALS['tmpl']->processIncludes();
$hierarArr = array();
$head = '<tr class="t3-row-header">';
$head .= '<td>' . $GLOBALS['LANG']->getLL('title', TRUE) . '</td>';
$head .= '<td>' . $GLOBALS['LANG']->getLL('rootlevel', TRUE) . '</td>';
$head .= '<td>' . $GLOBALS['LANG']->getLL('clearSetup', TRUE) . '</td>';
$head .= '<td>' . $GLOBALS['LANG']->getLL('clearConstants', TRUE) . '</td>';
$head .= '<td>' . $GLOBALS['LANG']->getLL('pid', TRUE) . '</td>';
$head .= '<td>' . $GLOBALS['LANG']->getLL('rootline', TRUE) . '</td>';
$head .= '<td>' . $GLOBALS['LANG']->getLL('nextLevel', TRUE) . '</td>';
$head .= '</tr>';
$hierar = implode(array_reverse($GLOBALS['tmpl']->ext_getTemplateHierarchyArr($GLOBALS['tmpl']->hierarchyInfoArr, '', array(), 1)), '');
$hierar = '<table id="ts-analyzer" cellpadding="0" cellspacing="0">' . $head . $hierar . '</table>';
$theOutput .= $this->pObj->doc->spacer(5);
$theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('templateHierarchy', TRUE), $hierar, 0, 1);
$urlParameters = array('id' => $GLOBALS['SOBE']->id, 'template' => 'all');
$aHref = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_ts', $urlParameters);
$completeLink = '<p><a href="' . htmlspecialchars($aHref) . '">' . $GLOBALS['LANG']->getLL('viewCompleteTS', TRUE) . '</a></p>';
$theOutput .= $this->pObj->doc->spacer(5);
$theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('completeTS', TRUE), $completeLink, 0, 1);
$theOutput .= $this->pObj->doc->spacer(15);
// Output options
$theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('displayOptions', TRUE), '', FALSE, TRUE);
$addParams = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template') ? '&template=' . \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template') : '';
$theOutput .= '<div class="tst-analyzer-options">' . \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_analyzer_checkLinenum]', $this->pObj->MOD_SETTINGS['ts_analyzer_checkLinenum'], '', $addParams, 'id="checkTs_analyzer_checkLinenum"') . '<label for="checkTs_analyzer_checkLinenum">' . $GLOBALS['LANG']->getLL('lineNumbers', TRUE) . '</label> ' . \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_analyzer_checkSyntax]', $this->pObj->MOD_SETTINGS['ts_analyzer_checkSyntax'], '', $addParams, 'id="checkTs_analyzer_checkSyntax"') . '<label for="checkTs_analyzer_checkSyntax">' . $GLOBALS['LANG']->getLL('syntaxHighlight', TRUE) . '</label> ' . (!$this->pObj->MOD_SETTINGS['ts_analyzer_checkSyntax'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_analyzer_checkComments]', $this->pObj->MOD_SETTINGS['ts_analyzer_checkComments'], '', $addParams, 'id="checkTs_analyzer_checkComments"') . '<label for="checkTs_analyzer_checkComments">' . $GLOBALS['LANG']->getLL('comments', TRUE) . '</label> ' . \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_analyzer_checkCrop]', $this->pObj->MOD_SETTINGS['ts_analyzer_checkCrop'], '', $addParams, 'id="checkTs_analyzer_checkCrop"') . '<label for="checkTs_analyzer_checkCrop">' . $GLOBALS['LANG']->getLL('cropLines', TRUE) . '</label> ' : '') . '</div>';
$theOutput .= $this->pObj->doc->spacer(25);
// Output Constants
if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template')) {
$theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('constants', TRUE), '', 0, 1);
$theOutput .= $this->pObj->doc->sectionEnd();
$theOutput .= '
<table class="ts-typoscript" border="0" cellpadding="1" cellspacing="0">
';
// Don't know why -2 and not 0... :-) But works.
$GLOBALS['tmpl']->ext_lineNumberOffset = -2;
$GLOBALS['tmpl']->ext_lineNumberOffset_mode = 'const';
$GLOBALS['tmpl']->ext_lineNumberOffset += count(explode(LF, \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::checkIncludeLines('' . $GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_constants']))) + 1;
reset($GLOBALS['tmpl']->clearList_const);
foreach ($GLOBALS['tmpl']->constants as $key => $val) {
$cVal = current($GLOBALS['tmpl']->clearList_const);
if ($cVal == \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template') || \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template') == 'all') {
$theOutput .= '
<tr>
</td><td class="bgColor2"><strong>' . htmlspecialchars($GLOBALS['tmpl']->templateTitles[$cVal]) . '</strong></td></tr>
<tr>
<td class="bgColor2"><table border="0" cellpadding="0" cellspacing="0" class="bgColor0" width="100%"><tr><td nowrap="nowrap">' . $GLOBALS['tmpl']->ext_outputTS(array($val), $this->pObj->MOD_SETTINGS['ts_analyzer_checkLinenum'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkComments'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkCrop'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkSyntax'], 0) . '</td></tr></table>
</td>
</tr>
';
if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template') != 'all') {
break;
}
}
$GLOBALS['tmpl']->ext_lineNumberOffset += count(explode(LF, $val)) + 1;
next($GLOBALS['tmpl']->clearList_const);
}
$theOutput .= '
</table>
';
}
// Output setup
if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template')) {
$theOutput .= $this->pObj->doc->spacer(15);
$theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('setup', TRUE), '', 0, 1);
$theOutput .= $this->pObj->doc->sectionEnd();
$theOutput .= '
<table class="ts-typoscript" border="0" cellpadding="1" cellspacing="0">
';
$GLOBALS['tmpl']->ext_lineNumberOffset = 0;
$GLOBALS['tmpl']->ext_lineNumberOffset_mode = 'setup';
$GLOBALS['tmpl']->ext_lineNumberOffset += count(explode(LF, \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::checkIncludeLines('' . $GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_setup']))) + 1;
reset($GLOBALS['tmpl']->clearList_setup);
//.........这里部分代码省略.........
示例7: loadTypoScriptFromFile
/**
* @static
* @throws Exception if file not found
* @param string $tsSetupFilePath path to typoscript file
* @return array ts-Config
*/
public static function loadTypoScriptFromFile($tsSetupFilePath)
{
if (!file_exists($tsSetupFilePath)) {
throw new Exception('No Typoscript file found at path ' . $tsSetupFilePath . ' 1316733309');
}
$rawTsConfig = file_get_contents($tsSetupFilePath);
$tsParser = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
/** @var $tsParser \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser */
$tsLines = explode(LF, $rawTsConfig);
foreach ($tsLines as &$value) {
$includeData = \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::checkIncludeLines($value, 1, true);
$value = $includeData['typoscript'];
}
$rawTsConfig = implode(LF, $tsLines);
$tsParser->parse($rawTsConfig);
$tsArray = $tsParser->setup;
return $tsArray;
}