本文整理汇总了PHP中TYPO3\CMS\Core\Utility\GeneralUtility::_GETset方法的典型用法代码示例。如果您正苦于以下问题:PHP GeneralUtility::_GETset方法的具体用法?PHP GeneralUtility::_GETset怎么用?PHP GeneralUtility::_GETset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\GeneralUtility
的用法示例。
在下文中一共展示了GeneralUtility::_GETset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCurrentPageIdReturnsPageIdFromPost
/**
* @test
*/
public function getCurrentPageIdReturnsPageIdFromPost()
{
\TYPO3\CMS\Core\Utility\GeneralUtility::_GETset(array('id' => 123));
$_POST['id'] = 321;
$expectedResult = 321;
$actualResult = $this->backendConfigurationManager->_call('getCurrentPageId');
$this->assertEquals($expectedResult, $actualResult);
}
示例2: viewReturnsCurrentFieldValueIfValueInGPAvailable
/**
* @test
* @return void
*/
public function viewReturnsCurrentFieldValueIfValueInGPAvailable()
{
\TYPO3\CMS\Core\Utility\GeneralUtility::_GETset(['tx_sfeventmgt_pievent' => ['registration' => ['fieldname' => 'Existing Value']]]);
$GLOBALS['TSFE'] = new \stdClass();
$viewHelper = new PrefillViewHelper();
$actual = $viewHelper->render('fieldname', []);
$this->assertSame('Existing Value', $actual);
}
示例3: initializeTsfe
/**
* Initializes the TSFE for a given page ID and language.
*
* @param integer The page id to initialize the TSFE for
* @param integer System language uid, optional, defaults to 0
* @param boolean Use cache to reuse TSFE
* @return void
*/
public static function initializeTsfe($pageId, $language = 0, $useCache = TRUE)
{
static $tsfeCache = array();
// resetting, a TSFE instance with data from a different page Id could be set already
unset($GLOBALS['TSFE']);
$cacheId = $pageId . '|' . $language;
if (!is_object($GLOBALS['TT'])) {
$GLOBALS['TT'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_TimeTrackNull');
}
if (!isset($tsfeCache[$cacheId]) || !$useCache) {
\TYPO3\CMS\Core\Utility\GeneralUtility::_GETset($language, 'L');
$GLOBALS['TSFE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tslib_fe', $GLOBALS['TYPO3_CONF_VARS'], $pageId, 0);
// for certain situations we need to trick TSFE into granting us
// access to the page in any case to make getPageAndRootline() work
// see http://forge.typo3.org/issues/42122
$pageRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $pageId);
$groupListBackup = $GLOBALS['TSFE']->gr_list;
$GLOBALS['TSFE']->gr_list = $pageRecord['fe_group'];
$GLOBALS['TSFE']->sys_page = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_pageSelect');
$GLOBALS['TSFE']->getPageAndRootline();
// restore gr_list
$GLOBALS['TSFE']->gr_list = $groupListBackup;
$GLOBALS['TSFE']->initTemplate();
$GLOBALS['TSFE']->forceTemplateParsing = TRUE;
$GLOBALS['TSFE']->initFEuser();
$GLOBALS['TSFE']->initUserGroups();
// $GLOBALS['TSFE']->getCompressedTCarray(); // seems to cause conflicts sometimes
$GLOBALS['TSFE']->no_cache = TRUE;
$GLOBALS['TSFE']->tmpl->start($GLOBALS['TSFE']->rootLine);
$GLOBALS['TSFE']->no_cache = FALSE;
$GLOBALS['TSFE']->getConfigArray();
$GLOBALS['TSFE']->settingLanguage();
$GLOBALS['TSFE']->newCObj();
$GLOBALS['TSFE']->absRefPrefix = $GLOBALS['TSFE']->config['config']['absRefPrefix'] ? trim($GLOBALS['TSFE']->config['config']['absRefPrefix']) : '';
if ($useCache) {
$tsfeCache[$cacheId] = $GLOBALS['TSFE'];
}
}
if ($useCache) {
$GLOBALS['TSFE'] = $tsfeCache[$cacheId];
}
}
示例4: guardLanguageRequestParameterForTtContent
public function guardLanguageRequestParameterForTtContent()
{
if (!is_array(GeneralUtility::_GET('data'))) {
return;
}
$data = GeneralUtility::_GET('data');
if (count($data) !== 1) {
return;
}
if (!array_key_exists('tt_content', $data) || !is_array($data['tt_content'])) {
return;
}
if (count($data['tt_content']) !== 1) {
return;
}
$recordId = key($data['tt_content']);
$keys = array_intersect_key($data['tt_content'][$recordId], array_flip($this->requiredUpdateFields));
if (count($keys) !== count($this->requiredUpdateFields)) {
return;
}
unset($data['tt_content'][$recordId]['sys_language_uid']);
GeneralUtility::_GETset($data, 'data');
}
示例5: getConfiguredSolrConnectionByRootPage
/**
* Gets the configured Solr connection for a specific root page and language ID.
*
* @param array $rootPage A root page record with at least title and uid
* @param integer $languageId ID of a system language
* @return array A solr connection configuration.
*/
protected function getConfiguredSolrConnectionByRootPage(array $rootPage, $languageId)
{
$connection = array();
$languageId = intval($languageId);
GeneralUtility::_GETset($languageId, 'L');
$connectionKey = $rootPage['uid'] . '|' . $languageId;
$pageSelect = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
$rootLine = $pageSelect->getRootLine($rootPage['uid']);
$tmpl = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\ExtendedTemplateService');
$tmpl->tt_track = false;
// Do not log time-performance information
$tmpl->init();
$tmpl->runThroughTemplates($rootLine);
// This generates the constants/config + hierarchy info for the template.
// fake micro TSFE to get correct condition parsing
$GLOBALS['TSFE'] = new \stdClass();
$GLOBALS['TSFE']->tmpl = new \stdClass();
$GLOBALS['TSFE']->tmpl->rootLine = $rootLine;
$GLOBALS['TSFE']->sys_page = $pageSelect;
$GLOBALS['TSFE']->id = $rootPage['uid'];
$GLOBALS['TSFE']->page = $rootPage;
$tmpl->generateConfig();
list($solrSetup) = $tmpl->ext_getSetup($tmpl->setup, 'plugin.tx_solr.solr');
list(, $solrEnabled) = $tmpl->ext_getSetup($tmpl->setup, 'plugin.tx_solr.enabled');
$solrEnabled = !empty($solrEnabled) ? true : false;
if (!empty($solrSetup) && $solrEnabled) {
$solrPath = trim($solrSetup['path'], '/');
$solrPath = '/' . $solrPath . '/';
$connection = array('connectionKey' => $connectionKey, 'rootPageTitle' => $rootPage['title'], 'rootPageUid' => $rootPage['uid'], 'solrScheme' => $solrSetup['scheme'], 'solrHost' => $solrSetup['host'], 'solrPort' => $solrSetup['port'], 'solrPath' => $solrPath, 'language' => $languageId);
$connection['label'] = $this->buildConnectionLabel($connection);
}
return $connection;
}
示例6: initializeAction
/**
* Initializes all actions.
*
* @return void
*/
protected function initializeAction()
{
$this->id = (int) GeneralUtility::_GET('id');
$this->databaseConnection = $GLOBALS['TYPO3_DB'];
// Fix pagers
$arguments = GeneralUtility::_GPmerged($this->argumentsKey);
if ($arguments && is_array($arguments)) {
foreach ($arguments as $argumentKey => $argumentValue) {
if ($argumentValue) {
if (!in_array($argumentKey, $this->excludedArguments)) {
GeneralUtility::_GETset($argumentValue, $this->argumentsKey . '|' . $argumentKey);
} else {
GeneralUtility::_GETset('', $this->argumentsKey . '|' . $argumentKey);
}
}
}
} else {
$this->forwardToLastModule();
}
parent::initializeAction();
}
示例7: canCreateSortUrls
/**
* Tests the sort url creation
*
* @dataProvider sortUrlCreationDataProvider
* @test
*
* @param string $currentSorting the current sort parameters
* @param string $sorting the requested sorting
* @param string $expectedResult
* @return void
*/
public function canCreateSortUrls($currentSorting, $sorting, $expectedResult)
{
GeneralUtility::_GETset(array('sort' => $currentSorting), 'tx_solr');
$sortUrl = $this->viewHelper->execute(array($sorting));
$this->assertEquals($expectedResult, $sortUrl['sort'], 'Sort url parameter "' . $sortUrl['sort'] . '" doesn\'t match the expected parameters: ' . $expectedResult);
}
示例8: buildBackendUriCreatesAbsoluteUrisIfSpecified
/**
* @test
*/
public function buildBackendUriCreatesAbsoluteUrisIfSpecified()
{
GeneralUtility::flushInternalRuntimeCaches();
GeneralUtility::_GETset(array('M' => 'moduleKey'));
$_SERVER['HTTP_HOST'] = 'baseuri';
$_SERVER['SCRIPT_NAME'] = '/typo3/index.php';
$this->mockRequest->expects($this->any())->method('getBaseUri')->will($this->returnValue('http://baseuri'));
$this->uriBuilder->setCreateAbsoluteUri(true);
$expectedResult = 'http://baseuri/' . TYPO3_mainDir . 'index.php?M=moduleKey&moduleToken=dummyToken';
$actualResult = $this->uriBuilder->buildBackendUri();
$this->assertSame($expectedResult, $actualResult);
}
示例9: generateWorkspaceSplittedPreviewLink
/**
* Generates a workspace splitted preview link.
*
* @param int $uid The ID of the record to be linked
* @param bool $addDomain Parameter to decide if domain should be added to the generated link, FALSE per default
* @return string the preview link without the trailing '/'
*/
public function generateWorkspaceSplittedPreviewLink($uid, $addDomain = false)
{
// In case a $pageUid is submitted we need to make sure it points to a live-page
if ($uid > 0) {
$uid = $this->getLivePageUid($uid);
}
/** @var $uriBuilder \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder */
$uriBuilder = $this->getObjectManager()->get(\TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder::class);
$redirect = 'index.php?redirect_url=';
// @todo this should maybe be changed so that the extbase URI Builder can deal with module names directly
$originalM = GeneralUtility::_GET('M');
GeneralUtility::_GETset('web_WorkspacesWorkspaces', 'M');
$viewScript = $uriBuilder->uriFor('index', array(), 'Preview', 'workspaces', 'web_workspacesworkspaces') . '&id=';
GeneralUtility::_GETset($originalM, 'M');
if ($addDomain === true) {
return BackendUtility::getViewDomain($uid) . $redirect . urlencode($viewScript) . $uid;
} else {
return $viewScript;
}
}
示例10: setPageUid
/**
* Set storage pid in BE
*
* Only needed when the class is called or injected in a BE context, e.g. a hook.
* Without the generation of the TS is based upon the next root page (default
* extbase behaviour) and repositories won't work as expected.
*
* @param $pageUid
*
* @return void
*/
public function setPageUid($pageUid)
{
if (TYPO3_MODE === 'BE') {
$currentPid['persistence']['storagePid'] = (int) $pageUid;
$this->configurationManager->setConfiguration(array_merge($this->getFrameworkSettings(), $currentPid));
GeneralUtility::_GETset((int) $pageUid, 'id');
}
}
示例11: buildBackendUriCreatesAbsoluteUrisIfSpecified
/**
* @test
*/
public function buildBackendUriCreatesAbsoluteUrisIfSpecified()
{
\TYPO3\CMS\Core\Utility\GeneralUtility::_GETset(array('M' => 'moduleKey'));
$this->mockRequest->expects($this->any())->method('getBaseUri')->will($this->returnValue('http://baseuri/' . TYPO3_mainDir));
$this->uriBuilder->setCreateAbsoluteUri(TRUE);
$expectedResult = 'http://baseuri/' . TYPO3_mainDir . 'mod.php?M=moduleKey&moduleToken=dummyToken';
$actualResult = $this->uriBuilder->buildBackendUri();
$this->assertSame($expectedResult, $actualResult);
}
示例12: setExternalJumpUrl
/**
* Sets the jumpurl for page type "External URL"
*
* @return void
*/
public function setExternalJumpUrl()
{
if ($extUrl = $this->sys_page->getExtURL($this->page, $this->config['config']['disablePageExternalUrl'])) {
$this->jumpurl = $extUrl;
GeneralUtility::_GETset(GeneralUtility::hmac($this->jumpurl, 'jumpurl'), 'juHash');
}
}
示例13: getPreviewConfiguration
/**
* Looking for a ADMCMD_prev code, looks it up if found and returns configuration data.
* Background: From the backend a request to the frontend to show a page, possibly with
* workspace preview can be "recorded" and associated with a keyword.
* When the frontend is requested with this keyword the associated request parameters are
* restored from the database AND the backend user is loaded - only for that request.
* The main point is that a special URL valid for a limited time,
* eg. http://localhost/typo3site/index.php?ADMCMD_prev=035d9bf938bd23cb657735f68a8cedbf will
* open up for a preview that doesn't require login. Thus it's useful for sending in an email
* to someone without backend account.
* This can also be used to generate previews of hidden pages, start/endtimes, usergroups and
* those other settings from the Admin Panel - just not implemented yet.
*
* @throws \Exception
* @return array Preview configuration array from sys_preview record.
*/
public function getPreviewConfiguration()
{
$inputCode = $this->getPreviewInputCode();
// If inputcode is available, look up the settings
if ($inputCode) {
// "log out"
if ($inputCode == 'LOGOUT') {
setcookie($this->previewKey, '', 0, GeneralUtility::getIndpEnv('TYPO3_SITE_PATH'));
if ($this->tsfeObj->TYPO3_CONF_VARS['FE']['workspacePreviewLogoutTemplate']) {
$templateFile = PATH_site . $this->tsfeObj->TYPO3_CONF_VARS['FE']['workspacePreviewLogoutTemplate'];
if (@is_file($templateFile)) {
$message = GeneralUtility::getUrl(PATH_site . $this->tsfeObj->TYPO3_CONF_VARS['FE']['workspacePreviewLogoutTemplate']);
} else {
$message = '<strong>ERROR!</strong><br>Template File "' . $this->tsfeObj->TYPO3_CONF_VARS['FE']['workspacePreviewLogoutTemplate'] . '" configured with $TYPO3_CONF_VARS["FE"]["workspacePreviewLogoutTemplate"] not found. Please contact webmaster about this problem.';
}
} else {
$message = 'You logged out from Workspace preview mode. Click this link to <a href="%1$s">go back to the website</a>';
}
$returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GET('returnUrl'));
die(sprintf($message, htmlspecialchars(preg_replace('/\\&?' . $this->previewKey . '=[[:alnum:]]+/', '', $returnUrl))));
}
// Look for keyword configuration record:
$where = 'keyword=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($inputCode, 'sys_preview') . ' AND endtime>' . $GLOBALS['EXEC_TIME'];
$previewData = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'sys_preview', $where);
// Get: Backend login status, Frontend login status
// - Make sure to remove fe/be cookies (temporarily);
// BE already done in ADMCMD_preview_postInit()
if (is_array($previewData)) {
if (!count(GeneralUtility::_POST())) {
// Unserialize configuration:
$previewConfig = unserialize($previewData['config']);
// For full workspace preview we only ADD a get variable
// to set the preview of the workspace - so all other Get
// vars are accepted. Hope this is not a security problem.
// Still posting is not allowed and even if a backend user
// get initialized it shouldn't lead to situations where
// users can use those credentials.
if ($previewConfig['fullWorkspace']) {
// Set the workspace preview value:
GeneralUtility::_GETset($previewConfig['fullWorkspace'], 'ADMCMD_previewWS');
// If ADMCMD_prev is set the $inputCode value cannot come
// from a cookie and we set that cookie here. Next time it will
// be found from the cookie if ADMCMD_prev is not set again...
if (GeneralUtility::_GP($this->previewKey)) {
// Lifetime is 1 hour, does it matter much?
// Requires the user to click the link from their email again if it expires.
SetCookie($this->previewKey, GeneralUtility::_GP($this->previewKey), 0, GeneralUtility::getIndpEnv('TYPO3_SITE_PATH'));
}
return $previewConfig;
} elseif (GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'index.php?' . $this->previewKey . '=' . $inputCode === GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL')) {
// Set GET variables
$GET_VARS = '';
parse_str($previewConfig['getVars'], $GET_VARS);
GeneralUtility::_GETset($GET_VARS);
// Return preview keyword configuration
return $previewConfig;
} else {
// This check is to prevent people from setting additional
// GET vars via realurl or other URL path based ways of passing parameters.
throw new \Exception(htmlspecialchars('Request URL did not match "' . GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'index.php?' . $this->previewKey . '=' . $inputCode . '"', 1294585190));
}
} else {
throw new \Exception('POST requests are incompatible with keyword preview.', 1294585191);
}
} else {
throw new \Exception('ADMCMD command could not be executed! (No keyword configuration found)', 1294585192);
}
}
return FALSE;
}
示例14: generateWorkspaceSplittedPreviewLink
/**
* Generates a workspace splitted preview link.
*
* @param integer $uid The ID of the record to be linked
* @param boolean $addDomain Parameter to decide if domain should be added to the generated link, FALSE per default
* @return string the preview link without the trailing '/'
*/
public function generateWorkspaceSplittedPreviewLink($uid, $addDomain = FALSE)
{
// In case a $pageUid is submitted we need to make sure it points to a live-page
if ($uid > 0) {
$uid = $this->getLivePageUid($uid);
}
/** @var $uriBuilder \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder */
$uriBuilder = $this->getObjectManager()->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder');
// This seems to be very harsh to set this directly to "/typo3 but the viewOnClick also
// has /index.php as fixed value here and dealing with the backPath is very error-prone
// @todo make sure this would work in local extension installation too
$backPath = '/' . TYPO3_mainDir;
$redirect = $backPath . 'index.php?redirect_url=';
// @todo this should maybe be changed so that the extbase URI Builder can deal with module names directly
$originalM = GeneralUtility::_GET('M');
GeneralUtility::_GETset('web_WorkspacesWorkspaces', 'M');
$viewScript = $backPath . $uriBuilder->uriFor('index', array(), 'Preview', 'workspaces', 'web_workspacesworkspaces') . '&id=';
GeneralUtility::_GETset($originalM, 'M');
if ($addDomain === TRUE) {
return BackendUtility::getViewDomain($uid) . $redirect . urlencode($viewScript) . $uid;
} else {
return $viewScript;
}
}
示例15: addRequestArgumentsToGlobal
/**
* Adds an array to the PHP global $_GET var.
*
* @param array $arguments The arguments you want to add.
*/
private function addRequestArgumentsToGlobal($arguments)
{
GeneralUtility::_GETset($arguments);
}