本文整理汇总了PHP中misc::setSettings方法的典型用法代码示例。如果您正苦于以下问题:PHP misc::setSettings方法的具体用法?PHP misc::setSettings怎么用?PHP misc::setSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类misc
的用法示例。
在下文中一共展示了misc::setSettings方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
protected function init()
{
$this->settings = $this->getSettings();
$this->formValuesPrefix = Tx_Formhandler_StaticFuncs::getSingle($this->settings, 'formValuesPrefix');
Tx_Formhandler_Globals::$formID = Tx_Formhandler_StaticFuncs::getSingle($this->settings, 'formID');
Tx_Formhandler_Globals::$formValuesPrefix = $this->formValuesPrefix;
//set debug mode
$isDebugMode = Tx_Formhandler_StaticFuncs::getSingle($this->settings, 'debug');
$this->debugMode = intval($isDebugMode) === 1;
$sessionClass = 'Tx_Formhandler_Session_PHP';
if ($this->settings['session.']) {
$sessionClass = Tx_Formhandler_StaticFuncs::prepareClassName($this->settings['session.']['class']);
}
Tx_Formhandler_Globals::$session = $this->componentManager->getComponent($sessionClass);
$this->gp = Tx_Formhandler_Staticfuncs::getMergedGP();
$randomID = $this->gp['randomID'];
if (!$randomID) {
$randomID = Tx_Formhandler_StaticFuncs::generateRandomID();
}
Tx_Formhandler_Globals::$randomID = $randomID;
$action = t3lib_div::_GP('action');
if (Tx_Formhandler_Globals::$formValuesPrefix) {
$temp = t3lib_div::_GP(Tx_Formhandler_Globals::$formValuesPrefix);
$action = $temp['action'];
}
if (Tx_Formhandler_Globals::$session->get('finished') && !$action) {
Tx_Formhandler_Globals::$session->reset();
unset($_GET[Tx_Formhandler_Globals::$formValuesPrefix]);
unset($_GET['id']);
Tx_Formhandler_StaticFuncs::doRedirect($GLOBALS['TSFE']->id, FALSE, $_GET);
exit;
}
$this->parseConditions();
$this->initializeDebuggers();
$this->getStepInformation();
$currentStepFromSession = Tx_Formhandler_Globals::$session->get('currentStep');
$prevStep = $currentStepFromSession;
if (intval($prevStep) !== intval($currentStepFromSession)) {
$this->currentStep = 1;
$this->lastStep = 1;
Tx_Formhandler_StaticFuncs::throwException('You messed with the steps!');
}
$this->mergeGPWithSession(FALSE, $this->currentStep);
$this->parseConditions();
//read template file
$this->templateFile = Tx_Formhandler_StaticFuncs::readTemplateFile($this->templateFile, $this->settings);
Tx_Formhandler_Globals::$templateCode = $this->templateFile;
$this->langFiles = Tx_Formhandler_StaticFuncs::readLanguageFiles($this->langFiles, $this->settings);
Tx_Formhandler_Globals::$langFiles = $this->langFiles;
$this->validateConfig();
Tx_Formhandler_Globals::$settings = $this->settings;
//set debug mode again cause it may have changed in specific step settings
$this->debugMode = intval($this->settings['debug']) === 1;
Tx_Formhandler_Globals::$session->set('debug', $this->debugMode);
Tx_Formhandler_StaticFuncs::debugMessage('using_prefix', array($this->formValuesPrefix));
//init view
$viewClass = $this->settings['view'];
if (!$viewClass) {
$viewClass = 'Tx_Formhandler_View_Form';
}
Tx_Formhandler_StaticFuncs::debugMessage('using_view', array($viewClass));
Tx_Formhandler_StaticFuncs::debugMessage('current_gp', array(), 1, $this->gp);
$this->storeSettingsInSession();
$this->mergeGPWithSession(FALSE, $this->currentStep);
//set submitted
$this->submitted = $this->isFormSubmitted();
if (!$this->submitted) {
$this->reset();
}
// set stylesheet file(s)
$this->addCSS();
// add JavaScript file(s)
$this->addJS();
Tx_Formhandler_StaticFuncs::debugMessage('current_session_params', array(), 1, (array) Tx_Formhandler_Globals::$session->get('values'));
$viewClass = Tx_Formhandler_StaticFuncs::prepareClassName($viewClass);
$this->view = $this->componentManager->getComponent($viewClass);
$this->view->setLangFiles($this->langFiles);
$this->view->setSettings($this->settings);
Tx_Formhandler_Globals::$gp = $this->gp;
//init ajax
if ($this->settings['ajax.']) {
$class = $this->settings['ajax.']['class'];
if (!$class) {
$class = 'Tx_Formhandler_AjaxHandler_JQuery';
}
Tx_Formhandler_StaticFuncs::debugMessage('using_ajax', array($class));
$class = Tx_Formhandler_StaticFuncs::prepareClassName($class);
$ajaxHandler = $this->componentManager->getComponent($class);
Tx_Formhandler_Globals::$ajaxHandler = $ajaxHandler;
$ajaxHandler->init($this->settings['ajax.']['config.']);
$ajaxHandler->initAjax();
}
if (!$this->gp['randomID']) {
$this->gp['randomID'] = Tx_Formhandler_Globals::$randomID;
}
}
示例2: init
/**
* Init method for the controller.
* This method sets internal values, initializes the ajax handler and the session.
*
* @return void
*/
protected function init()
{
$this->settings = $this->getSettings();
$this->formValuesPrefix = $this->utilityFuncs->getSingle($this->settings, 'formValuesPrefix');
$this->globals->setFormID($this->utilityFuncs->getSingle($this->settings, 'formID'));
$this->globals->setFormValuesPrefix($this->formValuesPrefix);
$isDebugMode = $this->utilityFuncs->getSingle($this->settings, 'debug');
$this->debugMode = intval($isDebugMode) === 1;
$this->gp = $this->utilityFuncs->getMergedGP();
$randomID = $this->gp['randomID'];
if (!$randomID) {
if ($this->settings['uniqueFormID']) {
$randomID = $this->utilityFuncs->getSingle($this->settings, 'uniqueFormID');
} else {
$randomID = $this->utilityFuncs->generateRandomID();
}
}
$this->globals->setRandomID($randomID);
$sessionClass = $this->utilityFuncs->getPreparedClassName($this->settings['session.'], 'Session_PHP');
$session = $this->componentManager->getComponent($sessionClass);
$session->init($this->gp, $this->settings['session.']['config.']);
$session->start();
$this->globals->setSession($session);
$action = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('action');
if ($this->globals->getFormValuesPrefix()) {
$temp = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP($this->globals->getFormValuesPrefix());
$action = $temp['action'];
}
if ($this->globals->getSession()->get('finished') && !$action) {
$this->globals->getSession()->reset();
unset($_GET[$this->globals->getFormValuesPrefix()]);
unset($_GET['id']);
$this->utilityFuncs->doRedirect($GLOBALS['TSFE']->id, FALSE, $_GET);
exit;
}
$this->parseConditions();
$this->initializeDebuggers();
$this->getStepInformation();
$currentStepFromSession = $this->globals->getSession()->get('currentStep');
$prevStep = $currentStepFromSession;
if (intval($prevStep) !== intval($currentStepFromSession)) {
$this->currentStep = 1;
$this->lastStep = 1;
$this->utilityFuncs->throwException('You messed with the steps!');
}
$this->mergeGPWithSession();
$this->parseConditions();
if (intval($this->utilityFuncs->getSingle($this->settings, 'disableConfigValidation')) === 0) {
$this->validateConfig();
}
$this->globals->setSettings($this->settings);
//set debug mode again cause it may have changed in specific step settings
$isDebugMode = $this->utilityFuncs->getSingle($this->settings, 'debug');
$this->debugMode = intval($isDebugMode) === 1;
$this->globals->getSession()->set('debug', $this->debugMode);
$this->utilityFuncs->debugMessage('using_prefix', array($this->formValuesPrefix));
$this->globals->getSession()->set('predef', $this->globals->getPredef());
//init view
$viewClass = $this->utilityFuncs->getPreparedClassName($this->settings['view.'], 'View_Form');
$this->utilityFuncs->debugMessage('using_view', array($viewClass));
$this->utilityFuncs->debugMessage('current_gp', array(), 1, $this->gp);
$this->storeSettingsInSession();
$this->mergeGPWithSession();
$this->submitted = $this->isFormSubmitted();
$this->globals->setSubmitted($this->submitted);
if ($this->globals->getSession()->get('creationTstamp') === NULL) {
if ($this->submitted) {
$this->reset($this->gp);
$this->findCurrentStep();
$this->globals->getSession()->set('currentStep', $this->currentStep);
} else {
$this->reset();
}
}
$this->addCSS();
$this->addJS();
$this->addJSFooter();
$this->utilityFuncs->debugMessage('current_session_params', array(), 1, (array) $this->globals->getSession()->get('values'));
$this->view = $this->componentManager->getComponent($viewClass);
$this->view->setLangFiles($this->langFiles);
$this->view->setSettings($this->settings);
$this->globals->setGP($this->gp);
//init ajax
if ($this->settings['ajax.']) {
$class = $this->utilityFuncs->getPreparedClassName($this->settings['ajax.'], 'AjaxHandler_JQuery');
$this->utilityFuncs->debugMessage('using_ajax', array($class));
$ajaxHandler = $this->componentManager->getComponent($class);
$this->globals->setAjaxHandler($ajaxHandler);
$ajaxHandler->init($this->settings['ajax.']['config.']);
$ajaxHandler->initAjax();
}
if (!$this->gp['randomID']) {
$this->gp['randomID'] = $this->globals->getRandomID();
}
//.........这里部分代码省略.........