本文整理汇总了PHP中TYPO3\CMS\Core\Utility\GeneralUtility::revExplode方法的典型用法代码示例。如果您正苦于以下问题:PHP GeneralUtility::revExplode方法的具体用法?PHP GeneralUtility::revExplode怎么用?PHP GeneralUtility::revExplode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\GeneralUtility
的用法示例。
在下文中一共展示了GeneralUtility::revExplode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filterInlineChildren
/**
* Entry method for use as TCEMain "inline" field filter
*
* @param array $parameters
* @param \TYPO3\CMS\Core\DataHandling\DataHandler $tceMain
* @return array
*/
public function filterInlineChildren(array $parameters, \TYPO3\CMS\Core\DataHandling\DataHandler $tceMain)
{
$values = $parameters['values'];
if ($parameters['allowedFileExtensions']) {
$this->setAllowedFileExtensions($parameters['allowedFileExtensions']);
}
if ($parameters['disallowedFileExtensions']) {
$this->setDisallowedFileExtensions($parameters['disallowedFileExtensions']);
}
$cleanValues = array();
if (is_array($values)) {
foreach ($values as $value) {
if (empty($value)) {
continue;
}
$parts = \TYPO3\CMS\Core\Utility\GeneralUtility::revExplode('_', $value, 2);
$fileReferenceUid = $parts[count($parts) - 1];
$fileReference = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFileReferenceObject($fileReferenceUid);
$file = $fileReference->getOriginalFile();
if ($this->isAllowed($file->getName())) {
$cleanValues[] = $value;
} else {
// Remove the erroneously created reference record again
$tceMain->deleteAction('sys_file_reference', $fileReferenceUid);
}
}
}
return $cleanValues;
}
示例2: resolveRenderingConfiguration
/**
* @param Request $request
* @param RenderingContext $renderingContext
* @return array
*/
protected function resolveRenderingConfiguration(Request $request, RenderingContext $renderingContext)
{
$configuration = array();
if ($request->hasArgument('path')) {
$renderingPath = $request->getArgument('path');
}
if ($request->hasArgument('record')) {
if (strpos($request->getArgument('record'), '_') !== FALSE) {
list($table, $id) = GeneralUtility::revExplode('_', $request->getArgument('record'), 2);
} else {
$id = $request->getArgument('record');
}
}
if ($request->hasArgument('table')) {
$table = $request->getArgument('table');
}
if (empty($table) && empty($id)) {
$table = 'pages';
$id = $renderingContext->getFrontendController()->id;
if (!empty($id) && $renderingContext->getFrontendController()->page['pid'] === '0') {
// Allow rendering of a root page which has pid === 0 and will be denied otherwise
$configuration['dontCheckPid'] = '1';
}
}
if (!empty($id) && empty($table)) {
$table = 'tt_content';
}
$configuration['source'] = $table . '_' . $id;
$configuration['tables'] = $table;
if (!empty($renderingPath)) {
$configuration['conf.'][$table] = '< ' . $renderingPath;
}
return $configuration;
}
示例3: resolveRenderingConfiguration
/**
* @param Request $request
* @param RenderingContext $renderingContext
* @return array
*/
protected function resolveRenderingConfiguration(Request $request, RenderingContext $renderingContext)
{
$configuration = array();
if ($request->hasArgument('path')) {
$renderingPath = $request->getArgument('path');
}
if ($request->hasArgument('record')) {
if (strpos($request->getArgument('record'), '_') !== FALSE) {
list($table, $id) = GeneralUtility::revExplode('_', $request->getArgument('record'), 2);
} else {
$id = $request->getArgument('record');
}
}
if ($request->hasArgument('table')) {
$table = $request->getArgument('table');
}
if (empty($table) && empty($id)) {
$table = 'pages';
$id = $renderingContext->getFrontendController()->id;
}
if (!empty($id) && empty($table)) {
$table = 'tt_content';
}
if ($table === 'pages') {
// Allow rendering of a root page which has pid === 0 and would be denied otherwise
$rootLine = $renderingContext->getFrontendController()->sys_page->getRootLine($id);
// $rootLine[0] is the root page. Check if the page we're going to render is a root page.
// We explicitly ignore the case where the to be rendered id is in another root line (multi domain setup)
// as this would require an additional record lookup. The use case for this is very limited anyway
// and should be implemented in a different renderer instead of covering that here.
if ($rootLine[0]['uid'] === (string) $id) {
$configuration['dontCheckPid'] = '1';
}
}
$configuration['source'] = $table . '_' . $id;
$configuration['tables'] = $table;
if (!empty($renderingPath)) {
$configuration['conf.'][$table] = '< ' . $renderingPath;
}
return $configuration;
}
示例4: main
/**
* Main function
* Makes a header-location redirect to an edit form IF POSSIBLE from the passed data - otherwise the window will just close.
*
* @return void
* @todo Define visibility
*/
public function main()
{
if ($this->doClose) {
$this->closeWindow();
} else {
// Initialize:
$table = $this->P['table'];
$field = $this->P['field'];
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($table);
$config = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
$fTable = $this->P['currentValue'] < 0 ? $config['neg_foreign_table'] : $config['foreign_table'];
// Detecting the various allowed field type setups and acting accordingly.
if (is_array($config) && $config['type'] == 'select' && !$config['MM'] && $config['maxitems'] <= 1 && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->P['currentValue']) && $this->P['currentValue'] && $fTable) {
// SINGLE value:
$redirectUrl = 'alt_doc.php?returnUrl=' . rawurlencode('wizard_edit.php?doClose=1') . '&edit[' . $fTable . '][' . $this->P['currentValue'] . ']=edit';
\TYPO3\CMS\Core\Utility\HttpUtility::redirect($redirectUrl);
} elseif (is_array($config) && $this->P['currentSelectedValues'] && ($config['type'] == 'select' && $config['foreign_table'] || $config['type'] == 'group' && $config['internal_type'] == 'db')) {
// MULTIPLE VALUES:
// Init settings:
$allowedTables = $config['type'] == 'group' ? $config['allowed'] : $config['foreign_table'] . ',' . $config['neg_foreign_table'];
$prependName = 1;
$params = '';
// Selecting selected values into an array:
$dbAnalysis = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\RelationHandler');
$dbAnalysis->start($this->P['currentSelectedValues'], $allowedTables);
$value = $dbAnalysis->getValueArray($prependName);
// Traverse that array and make parameters for alt_doc.php:
foreach ($value as $rec) {
$recTableUidParts = \TYPO3\CMS\Core\Utility\GeneralUtility::revExplode('_', $rec, 2);
$params .= '&edit[' . $recTableUidParts[0] . '][' . $recTableUidParts[1] . ']=edit';
}
// Redirect to alt_doc.php:
\TYPO3\CMS\Core\Utility\HttpUtility::redirect('alt_doc.php?returnUrl=' . rawurlencode('wizard_edit.php?doClose=1') . $params);
} else {
$this->closeWindow();
}
}
}
示例5: revExplode
/**
* @param string $delimiter Delimiter string to explode with
* @param string $string The string to explode
* @param int $count Number of array entries
* @return array Exploded values
*/
public function revExplode($delimiter, $string, $count = 0)
{
return GeneralUtility::revExplode($delimiter, $string, $count);
}
示例6: freeIndexUidWhere
/**
* Where-clause for free index-uid value.
*
* @param integer Free Index UID value to limit search to.
* @return string WHERE SQL clause part.
*/
public function freeIndexUidWhere($freeIndexUid)
{
$freeIndexUid = (int) $freeIndexUid;
if ($freeIndexUid >= 0) {
// First, look if the freeIndexUid is a meta configuration:
$indexCfgRec = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('indexcfgs', 'index_config', 'type=5 AND uid=' . $freeIndexUid . $this->enableFields('index_config'));
if (is_array($indexCfgRec)) {
$refs = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $indexCfgRec['indexcfgs']);
// Default value to protect against empty array.
$list = array(-99);
foreach ($refs as $ref) {
list($table, $uid) = \TYPO3\CMS\Core\Utility\GeneralUtility::revExplode('_', $ref, 2);
$uid = (int) $uid;
switch ($table) {
case 'index_config':
$idxRec = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('uid', 'index_config', 'uid=' . $uid . $this->enableFields('index_config'));
if ($idxRec) {
$list[] = $uid;
}
break;
case 'pages':
$indexCfgRecordsFromPid = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', 'index_config', 'pid=' . $uid . $this->enableFields('index_config'));
foreach ($indexCfgRecordsFromPid as $idxRec) {
$list[] = $idxRec['uid'];
}
break;
}
}
$list = array_unique($list);
} else {
$list = array($freeIndexUid);
}
return ' AND IP.freeIndexUid IN (' . implode(',', $list) . ')';
}
}
示例7: renderForeignRecordHeader
/**
* Renders the HTML header for a foreign record, such as the title, toggle-function, drag'n'drop, etc.
* Later on the command-icons are inserted here.
*
* @param string $parentUid The uid of the parent (embedding) record (uid or NEW...)
* @param string $foreign_table The foreign_table we create a header for
* @param array $rec The current record of that foreign_table
* @param array $config content of $PA['fieldConf']['config']
* @param boolean $isVirtualRecord
* @return string The HTML code of the header
* @todo Define visibility
*/
public function renderForeignRecordHeader($parentUid, $foreign_table, $rec, $config, $isVirtualRecord = FALSE)
{
// Init:
$objectId = $this->inlineNames['object'] . self::Structure_Separator . $foreign_table . self::Structure_Separator . $rec['uid'];
// We need the returnUrl of the main script when loading the fields via AJAX-call (to correct wizard code, so include it as 3rd parameter)
// Pre-Processing:
$isOnSymmetricSide = \TYPO3\CMS\Core\Database\RelationHandler::isOnSymmetricSide($parentUid, $config, $rec);
$hasForeignLabel = !$isOnSymmetricSide && $config['foreign_label'] ? TRUE : FALSE;
$hasSymmetricLabel = $isOnSymmetricSide && $config['symmetric_label'] ? TRUE : FALSE;
// Get the record title/label for a record:
// render using a self-defined user function
if ($GLOBALS['TCA'][$foreign_table]['ctrl']['label_userFunc']) {
$params = array('table' => $foreign_table, 'row' => $rec, 'title' => '', 'isOnSymmetricSide' => $isOnSymmetricSide, 'parent' => array('uid' => $parentUid, 'config' => $config));
// callUserFunction requires a third parameter, but we don't want to give $this as reference!
$null = NULL;
\TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($GLOBALS['TCA'][$foreign_table]['ctrl']['label_userFunc'], $params, $null);
$recTitle = $params['title'];
} elseif ($hasForeignLabel || $hasSymmetricLabel) {
$titleCol = $hasForeignLabel ? $config['foreign_label'] : $config['symmetric_label'];
$foreignConfig = $this->getPossibleRecordsSelectorConfig($config, $titleCol);
// Render title for everything else than group/db:
if ($foreignConfig['type'] != 'groupdb') {
$recTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValueExtra($foreign_table, $titleCol, $rec[$titleCol], 0, 0, FALSE);
} else {
// $recTitle could be something like: "tx_table_123|...",
$valueParts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('|', $rec[$titleCol]);
$itemParts = \TYPO3\CMS\Core\Utility\GeneralUtility::revExplode('_', $valueParts[0], 2);
$recTemp = \t3lib_befunc::getRecordWSOL($itemParts[0], $itemParts[1]);
$recTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($itemParts[0], $recTemp, FALSE);
}
$recTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitlePrep($recTitle);
if (!strcmp(trim($recTitle), '')) {
$recTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::getNoRecordTitle(TRUE);
}
} else {
$recTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($foreign_table, $rec, TRUE);
}
// Renders a thumbnail for the header
if (!empty($config['appearance']['headerThumbnail']['field'])) {
$fieldValue = $rec[$config['appearance']['headerThumbnail']['field']];
$firstElement = array_shift(\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $fieldValue));
$fileUid = array_pop(\TYPO3\CMS\Backend\Utility\BackendUtility::splitTable_Uid($firstElement));
if (!empty($fileUid)) {
$fileObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFileObject($fileUid);
if ($fileObject) {
$imageSetup = $config['appearance']['headerThumbnail'];
unset($imageSetup['field']);
$imageSetup = array_merge(array('width' => 64, 'height' => 64), $imageSetup);
$imageUrl = $fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW, $imageSetup)->getPublicUrl(TRUE);
$thumbnail = '<img src="' . $imageUrl . '" alt="' . htmlspecialchars($recTitle) . '">';
} else {
$thumbnail = FALSE;
}
}
}
$altText = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordIconAltText($rec, $foreign_table);
$iconImg = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($foreign_table, $rec, array('title' => htmlspecialchars($altText), 'id' => $objectId . '_icon'));
$label = '<span id="' . $objectId . '_label">' . $recTitle . '</span>';
$ctrl = $this->renderForeignRecordHeaderControl($parentUid, $foreign_table, $rec, $config, $isVirtualRecord);
$header = '<table>' . '<tr>' . (!empty($config['appearance']['headerThumbnail']['field']) && $thumbnail ? '<td class="t3-form-field-header-inline-thumbnail" id="' . $objectId . '_thumbnailcontainer">' . $thumbnail . '</td>' : '<td class="t3-form-field-header-inline-icon" id="' . $objectId . '_iconcontainer">' . $iconImg . '</td>') . '<td class="t3-form-field-header-inline-summary">' . $label . '</td>' . '<td clasS="t3-form-field-header-inline-ctrl">' . $ctrl . '</td>' . '</tr>' . '</table>';
return $header;
}
示例8: transferDeprecatedCurlSettings
/**
* Parse old curl options and set new http ones instead
*
* @return void
*/
protected function transferDeprecatedCurlSettings()
{
$changed = false;
try {
$curlProxyServer = $this->configurationManager->getLocalConfigurationValueByPath('SYS/curlProxyServer');
} catch (\RuntimeException $e) {
$curlProxyServer = '';
}
try {
$proxyHost = $this->configurationManager->getLocalConfigurationValueByPath('HTTP/proxy_host');
} catch (\RuntimeException $e) {
$proxyHost = '';
}
if (!empty($curlProxyServer) && empty($proxyHost)) {
$curlProxy = rtrim(preg_replace('#^https?://#', '', $curlProxyServer), '/');
$proxyParts = GeneralUtility::revExplode(':', $curlProxy, 2);
$this->configurationManager->setLocalConfigurationValueByPath('HTTP/proxy_host', $proxyParts[0]);
$this->configurationManager->setLocalConfigurationValueByPath('HTTP/proxy_port', $proxyParts[1]);
$changed = true;
}
try {
$curlProxyUserPass = $this->configurationManager->getLocalConfigurationValueByPath('SYS/curlProxyUserPass');
} catch (\RuntimeException $e) {
$curlProxyUserPass = '';
}
try {
$proxyUser = $this->configurationManager->getLocalConfigurationValueByPath('HTTP/proxy_user');
} catch (\RuntimeException $e) {
$proxyUser = '';
}
if (!empty($curlProxyUserPass) && empty($proxyUser)) {
$userPassParts = explode(':', $curlProxyUserPass, 2);
$this->configurationManager->setLocalConfigurationValueByPath('HTTP/proxy_user', $userPassParts[0]);
$this->configurationManager->setLocalConfigurationValueByPath('HTTP/proxy_password', $userPassParts[1]);
$changed = true;
}
try {
$curlUse = $this->configurationManager->getLocalConfigurationValueByPath('SYS/curlUse');
} catch (\RuntimeException $e) {
$curlUse = '';
}
try {
$adapter = $this->configurationManager->getConfigurationValueByPath('HTTP/adapter');
} catch (\RuntimeException $e) {
$adapter = '';
}
if (!empty($curlUse) && $adapter !== 'curl') {
$GLOBALS['TYPO3_CONF_VARS']['HTTP']['adapter'] = 'curl';
$this->configurationManager->setLocalConfigurationValueByPath('HTTP/adapter', 'curl');
$changed = true;
}
if ($changed) {
$this->throwRedirectException();
}
}
示例9: evaluateExpandCollapseParameter
/**
* Gets the values from the Expand/Collapse Parameter (&PM)
* previously known as "PM" (plus/minus)
* PM action:
* (If an plus/minus icon has been clicked,
* the PM GET var is sent and we must update the stored positions in the tree):
* 0: mount key, 1: set/clear boolean, 2: item ID (cannot contain "_"), 3: treeName
*
* @param string $PM The "plus/minus" command
* @return array
*/
protected function evaluateExpandCollapseParameter($PM = NULL)
{
if ($PM === NULL) {
$PM = GeneralUtility::_GP('PM');
// IE takes anchor as parameter
if (($PMpos = strpos($PM, '#')) !== FALSE) {
$PM = substr($PM, 0, $PMpos);
}
}
// Take the first three parameters
list($mountKey, $doExpand, $folderIdentifier) = explode('_', $PM, 3);
// In case the folder identifier contains "_", we just need to get the fourth/last parameter
list($folderIdentifier, $treeName) = GeneralUtility::revExplode('_', $folderIdentifier, 2);
return array($mountKey, $doExpand, $folderIdentifier, $treeName);
}
示例10: explodeElement
function explodeElement($elementList)
{
$elements = GeneralUtility::trimExplode(',', $elementList);
foreach ($elements as $k => $element) {
$elements[$k] = GeneralUtility::revExplode('_', $element, 2);
}
return $elements;
}
示例11: transferDeprecatedCurlSettings
/**
* Parse old curl options and set new http ones instead
*
* @TODO: This code segment must still be finished
* @return Bootstrap
*/
protected function transferDeprecatedCurlSettings()
{
if (!empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer'])) {
$proxyParts = Utility\GeneralUtility::revExplode(':', $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer'], 2);
$GLOBALS['TYPO3_CONF_VARS']['HTTP']['proxy_host'] = $proxyParts[0];
$GLOBALS['TYPO3_CONF_VARS']['HTTP']['proxy_port'] = $proxyParts[1];
}
if (!empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyUserPass'])) {
$userPassParts = explode(':', $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyUserPass'], 2);
$GLOBALS['TYPO3_CONF_VARS']['HTTP']['proxy_user'] = $userPassParts[0];
$GLOBALS['TYPO3_CONF_VARS']['HTTP']['proxy_password'] = $userPassParts[1];
}
return $this;
}
示例12: postProcessEncodedUrl
/**
* Post-processes the URL. If necessary prepends another domain to the URL.
*
* @param array $parameters
* @param ContentObjectRenderer $pObj
* @return void
*/
public function postProcessEncodedUrl(array &$parameters, ContentObjectRenderer $pObj)
{
if (isset($parameters['finalTagParts']['url'])) {
// We must check for absolute URLs here because typolink can force
// absolute URLs for pages with restricted access. It prepends
// current host always. See http://bugs.typo3.org/view.php?id=18200
$testUrl = $parameters['finalTagParts']['url'];
if (preg_match('/^https?:\\/\\/[^\\/]+\\//', $testUrl)) {
$testUrl = preg_replace('/https?:\\/\\/[^\\/]+\\/(.*)$/', $this->tsfe->absRefPrefix . '\\1', $testUrl);
}
list($testUrl, $section) = GeneralUtility::revExplode('#', $testUrl, 2);
if (isset(self::$urlPrependRegister[$testUrl])) {
$urlKey = $url = $testUrl;
$url = self::$urlPrependRegister[$urlKey] . ($url[0] != '/' ? '/' : '') . $url;
if ($section) {
$url .= '#' . $section;
}
unset(self::$urlPrependRegister[$testUrl]);
// Adjust the URL
$parameters['finalTag'] = str_replace('"' . htmlspecialchars($parameters['finalTagParts']['url']) . '"', '"' . htmlspecialchars($url) . '"', $parameters['finalTag']);
$parameters['finalTagParts']['url'] = $url;
$pObj->lastTypoLinkUrl = $url;
}
}
}
示例13: splitGroup
function splitGroup($group)
{
$groups = explode(',', $group);
foreach ($groups as $group) {
$item = \TYPO3\CMS\Core\Utility\GeneralUtility::revExplode('_', $group, 2);
$ret[$item[0]][] = $item[1];
}
return $ret;
}
示例14: decodeSpURL_decodeFileName
/**
* Decodes the file name and adjusts file parts accordingly
*
* @param array $pathParts Path parts of the URLs (can be modified)
* @return array GET varaibles from the file name or empty array
*/
protected function decodeSpURL_decodeFileName(array &$pathParts)
{
$getVars = array();
$fileName = array_pop($pathParts);
$fileParts = \TYPO3\CMS\Core\Utility\GeneralUtility::revExplode('.', $fileName, 2);
if (count($fileParts) == 2 && !$fileParts[1]) {
$this->decodeSpURL_throw404('File "' . $fileName . '" was not found (2)!');
}
list($segment, $extension) = $fileParts;
if ($extension) {
$getVars = array();
if (!$this->decodeSpURL_decodeFileName_lookupInIndex($fileName, $segment, $extension, $pathParts, $getVars)) {
if (!$this->decodeSpURL_decodeFileName_checkHtmlSuffix($fileName, $segment, $extension, $pathParts)) {
$this->decodeSpURL_throw404('File "' . $fileName . '" was not found (1)!');
}
}
} elseif ($fileName != '') {
$pathParts[] = $fileName;
}
return $getVars;
}
示例15: handleFileNameMappingToGetVar
/**
* Handles mapping of file names to GET vars (like 'print.html' => 'type=98')
*
* @param string $fileNameSegment
* @param array $getVars
* @param bool $putBack
* @return bool
*/
protected function handleFileNameMappingToGetVar(&$fileNameSegment, array &$getVars, &$putBack)
{
$result = false;
if ($fileNameSegment) {
$fileNameConfiguration = $this->configuration->get('fileName/index/' . $fileNameSegment);
if (is_array($fileNameConfiguration)) {
$result = true;
$putBack = false;
if (isset($fileNameConfiguration['keyValues'])) {
$getVars = $fileNameConfiguration['keyValues'];
}
} else {
list($fileName, $extension) = GeneralUtility::revExplode('.', $fileNameSegment, 2);
$fileNameConfiguration = $this->configuration->get('fileName/index/.' . $extension);
if (is_array($fileNameConfiguration)) {
$result = true;
$putBack = true;
$fileNameSegment = $fileName;
if (isset($fileNameConfiguration['keyValues'])) {
$getVars = $fileNameConfiguration['keyValues'];
}
}
}
}
return $result;
}