本文整理汇总了PHP中t3lib_div::trimExplode方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_div::trimExplode方法的具体用法?PHP t3lib_div::trimExplode怎么用?PHP t3lib_div::trimExplode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_div
的用法示例。
在下文中一共展示了t3lib_div::trimExplode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function &_getRowsSubpart($sTemplate)
{
$aRowsTmpl = array();
if (($sAltRows = $this->_navConf("/template/alternaterows")) !== FALSE) {
if (tx_ameosformidable::isRunneable($sAltRows)) {
$sAltRows = tx_ameosformidable::isRunneable($sAltRows);
}
if (!is_string($sAltRows)) {
$sAltRows = FALSE;
} else {
$sAltRows = trim($sAltRows);
}
}
$aAltList = t3lib_div::trimExplode(",", $sAltRows);
if (sizeof($aAltList) > 0) {
$sRowsPart = t3lib_parsehtml::getSubpart($sTemplate, "###ROWS###");
reset($aAltList);
while (list(, $sAltSubpart) = each($aAltList)) {
$sHtml = t3lib_parsehtml::getSubpart($sRowsPart, $sAltSubpart);
if (empty($sHtml)) {
$this->oForm->mayday("renderlet:" . $this->_getType() . "[name=" . $this->getName() . "] - The given template with subpart marquer <b>'" . $sAltSubpart . "'</b> returned an empty string - Please check your template!");
}
$aRowsTmpl[] = $sHtml;
}
}
return $aRowsTmpl;
}
示例2: main
/**
* Main function, rendering the element browser in RTE mode.
*
* @return void
*/
function main()
{
// Setting alternative browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
$altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints'));
if ($altMountPoints) {
$altMountPoints = t3lib_div::trimExplode(',', $altMountPoints);
foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
$GLOBALS['BE_USER']->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1, 'readonly');
}
$GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->returnFilemounts();
}
// Rendering type by user function
$browserRendered = false;
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'] as $classRef) {
$browserRenderObj = t3lib_div::getUserObj($classRef);
if (is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists($browserRenderObj, 'render')) {
if ($browserRenderObj->isValid($this->mode, $this)) {
$this->content .= $browserRenderObj->render($this->mode, $this);
$browserRendered = true;
break;
}
}
}
}
// If type was not rendered, use default rendering functions
if (!$browserRendered) {
$GLOBALS['SOBE']->browser = t3lib_div::makeInstance('tx_rtehtmlarea_select_image');
$GLOBALS['SOBE']->browser->init();
$modData = $GLOBALS['BE_USER']->getModuleData('select_image.php', 'ses');
list($modData, $store) = $GLOBALS['SOBE']->browser->processSessionData($modData);
$GLOBALS['BE_USER']->pushModuleData('select_image.php', $modData);
$this->content = $GLOBALS['SOBE']->browser->main_rte();
}
}
示例3: getDisableActions
/**
* Fetches the items that should be disabled from the context menu
*
* @return array
*/
protected function getDisableActions()
{
$tsConfig = $GLOBALS['BE_USER']->getTSConfig('options.contextMenu.' . $this->getContextMenuType() . '.disableItems');
$disableItems = array();
if (trim($tsConfig['value']) !== '') {
$disableItems = t3lib_div::trimExplode(',', $tsConfig['value']);
}
$tsConfig = $GLOBALS['BE_USER']->getTSConfig('options.contextMenu.pageTree.disableItems');
$oldDisableItems = array();
if (trim($tsConfig['value']) !== '') {
$oldDisableItems = t3lib_div::trimExplode(',', $tsConfig['value']);
}
$additionalItems = array();
foreach ($oldDisableItems as $item) {
if (!isset($this->legacyContextMenuMapping[$item])) {
$additionalItems[] = $item;
continue;
}
if (strpos($this->legacyContextMenuMapping[$item], ',')) {
$actions = t3lib_div::trimExplode(',', $this->legacyContextMenuMapping[$item]);
$additionalItems = array_merge($additionalItems, $actions);
} else {
$additionalItems[] = $item;
}
}
return array_merge($disableItems, $additionalItems);
}
示例4: process
/**
* The main method called by the controller
*
* @return array The probably modified GET/POST parameters
*/
public function process()
{
//parse as float
$fields = t3lib_div::trimExplode(',', $this->settings['parseFloatFields'], TRUE);
$this->parseFloats($fields);
return $this->gp;
}
示例5: extraItemMarkerProcessor
function extraItemMarkerProcessor($markerArray, $row, $lConf, &$pObj)
{
$markerArray['###PROFESSOREN_LINK###'] = $this->gibProfessorenLink($row);
$markerArray['###KANDIDAT###'] = $row['tx_hetools_kandidat_arbeit'];
// configuration of chgallery
$confDefault = $pObj->conf['genericmarkers.'];
if (!is_array($confDefault)) {
return $markerArray;
}
// merge with special configuration (based on chosen CODE [SINGLE, LIST, LATEST]) if this is available
if (is_array($confDefault[$pObj->config['code'] . '.'])) {
$conf = t3lib_div::array_merge_recursive_overrule($confDefault, $confDefault[$pObj->config['code'] . '.']);
} else {
$conf = $confDefault;
}
if (is_array($conf)) {
if ($conf['data'] != '') {
foreach (t3lib_div::trimExplode(',', $conf['data']) as $key) {
$pObj->cObj->data['generic_' . $key] = $row[$key];
}
}
foreach ($conf as $key => $value) {
$key2 = trim($key, '.');
$markerArray['###GENERIC_' . strtoupper($key2) . '###'] = $pObj->cObj->cObjGetSingle($conf[$key2], $conf[$key]);
}
}
return $markerArray;
}
示例6: build
/**
* build an array of image instances
*
* @param string|array $files string should use "," as seperator
* @param string $path
* @param string|array $alternateTexts string should use newline as seperator
* @param string|array $captions string should use newline as seperator
* @return array<Tx_CzEwlSponsor_Domain_Model_File>
*/
public static function build($files, $path, $alternates = '', $captions = '')
{
$return = array();
if (!is_array($files)) {
$files = is_string($files) && !empty($files) ? t3lib_div::trimExplode(",", $files, false) : array();
}
if (!is_array($alternates)) {
$alternates = is_string($alternates) && !empty($alternates) ? t3lib_div::trimExplode("\n", $alternates, false) : array();
}
if (!is_array($captions)) {
$captions = is_string($captions) && !empty($captions) ? t3lib_div::trimExplode("\n", $captions, false) : array();
}
if ($path && substr($path, -1) !== '/') {
$path = $path . '/';
}
foreach ($files as $key => $fileName) {
if (empty($fileName)) {
continue;
}
$file = new Tx_CzSimpleCal_Domain_Model_File();
$file->setPath($path);
$file->setFile($fileName);
if (array_key_exists($key, $captions) && $captions[$key]) {
$file->setCaption($captions[$key]);
}
if (array_key_exists($key, $alternates) && $alternates[$key]) {
$file->setAlternateText($alternates[$key]);
}
$return[] = $file;
}
return $return;
}
示例7: getSortingLinks
protected function getSortingLinks()
{
$sortHelper = t3lib_div::makeInstance('Tx_Solr_Sorting', $this->configuration['search.']['sorting.']['options.']);
$query = $this->search->getQuery();
$queryLinkBuilder = t3lib_div::makeInstance('Tx_Solr_Query_LinkBuilder', $query);
$queryLinkBuilder->setLinkTargetPageId($this->parentPlugin->getLinkTargetPageId());
$sortOptions = array();
$urlParameters = t3lib_div::_GP('tx_solr');
$urlSortParameters = t3lib_div::trimExplode(',', $urlParameters['sort']);
$configuredSortOptions = $sortHelper->getSortOptions();
foreach ($configuredSortOptions as $sortOptionName => $sortOption) {
$sortDirection = $this->configuration['search.']['sorting.']['defaultOrder'];
if (!empty($this->configuration['search.']['sorting.']['options.'][$sortOptionName . '.']['defaultOrder'])) {
$sortDirection = $this->configuration['search.']['sorting.']['options.'][$sortOptionName . '.']['defaultOrder'];
}
$sortIndicator = $sortDirection;
$currentSortOption = '';
$currentSortDirection = '';
foreach ($urlSortParameters as $urlSortParameter) {
$explodedUrlSortParameter = explode(' ', $urlSortParameter);
if ($explodedUrlSortParameter[0] == $sortOptionName) {
list($currentSortOption, $currentSortDirection) = $explodedUrlSortParameter;
break;
}
}
// toggle sorting direction for the current sorting field
if ($currentSortOption == $sortOptionName) {
switch ($currentSortDirection) {
case 'asc':
$sortDirection = 'desc';
$sortIndicator = 'asc';
break;
case 'desc':
$sortDirection = 'asc';
$sortIndicator = 'desc';
break;
}
}
if (!empty($this->configuration['search.']['sorting.']['options.'][$sortOptionName . '.']['fixedOrder'])) {
$sortDirection = $this->configuration['search.']['sorting.']['options.'][$sortOptionName . '.']['fixedOrder'];
}
$sortParameter = $sortOptionName . ' ' . $sortDirection;
$temp = array('link' => $queryLinkBuilder->getQueryLink($sortOption['label'], array('sort' => $sortParameter)), 'url' => $queryLinkBuilder->getQueryUrl(array('sort' => $sortParameter)), 'optionName' => $sortOptionName, 'field' => $sortOption['field'], 'label' => $sortOption['label'], 'is_current' => '0', 'direction' => $sortDirection, 'indicator' => $sortIndicator, 'current_direction' => ' ');
// set sort indicator for the current sorting field
if ($currentSortOption == $sortOptionName) {
$temp['selected'] = 'selected="selected"';
$temp['current'] = 'current';
$temp['is_current'] = '1';
$temp['current_direction'] = $sortIndicator;
}
// special case relevance: just reset the search to normal behavior
if ($sortOptionName == 'relevance') {
$temp['link'] = $queryLinkBuilder->getQueryLink($sortOption['label'], array('sort' => NULL));
$temp['url'] = $queryLinkBuilder->getQueryUrl(array('sort' => NULL));
unset($temp['direction'], $temp['indicator']);
}
$sortOptions[] = $temp;
}
return $sortOptions;
}
示例8: mail
/**
* Parses parts of the mail message and sends it with the Swift Mailer functions
*
* @param string $to Email address to send the message to
* @param string $subject Subject of mail message
* @param string $messageBody Raw body (may be multipart)
* @param array $additionalHeaders Additional mail headers
* @param array $additionalParameters Extra parameters for the mail() command
* @param bool $fakeSending If set fake sending a mail
* @throws t3lib_exception
* @return bool
*/
public function mail($to, $subject, $messageBody, $additionalHeaders = NULL, $additionalParameters = NULL, $fakeSending = FALSE)
{
// report success for fake sending
if ($fakeSending === TRUE) {
return TRUE;
}
$this->message->setSubject($subject);
// handle recipients
$toAddresses = $this->parseAddresses($to);
$this->message->setTo($toAddresses);
// handle additional headers
$headers = t3lib_div::trimExplode(LF, $additionalHeaders, TRUE);
$this->messageHeaders = $this->message->getHeaders();
foreach ($headers as $header) {
list($headerName, $headerValue) = t3lib_div::trimExplode(':', $header, FALSE, 2);
$this->setHeader($headerName, $headerValue);
}
// handle additional parameters (force return path)
if (preg_match('/-f\\s*(\\S*?)/', $additionalParameters, $matches)) {
$this->message->setReturnPath($this->unescapeShellArguments($matches[1]));
}
// handle from:
$this->fixSender();
// handle message body
$this->setBody($messageBody);
// send mail
$result = $this->mailer->send($this->message);
// report success/failure
return (bool) $result;
}
示例9: main
/**
* Main function
*
* @param clickMenu reference parent object
* @param array menutitems for manipultation
* @param string table name
* @param int uid
* @return array manipulated menuitems
*/
function main(clickMenu $backRef, array $menuItems, $table, $uid)
{
if ($table != 'tx_crawler_configuration') {
// early return without doing anything
return $menuItems;
}
$localItems = array();
$row = t3lib_BEfunc::getRecord($table, $uid, 'pid, name, processing_instruction_filter', '', true);
if (!empty($row)) {
if (version_compare(TYPO3_version, '4.5.0', '>=')) {
$url = t3lib_extMgm::extRelPath('info') . 'mod1/index.php';
} else {
$url = $backRef->backPath . 'mod/web/info/index.php';
}
$url .= '?id=' . intval($row['pid']);
$url .= '&SET[function]=tx_crawler_modfunc1';
$url .= '&SET[crawlaction]=start';
$url .= '&configurationSelection[]=' . $row['name'];
foreach (t3lib_div::trimExplode(',', $row['processing_instruction_filter']) as $processing_instruction) {
$url .= '&procInstructions[]=' . $processing_instruction;
}
// $onClick = $backRef->urlRefForCM($url);
$onClick = "top.nextLoadModuleUrl='" . $url . "';top.goToModule('web_info',1);";
$localItems[] = $backRef->linkItem('Crawl', $backRef->excludeIcon('<img src="' . $backRef->backPath . t3lib_extMgm::extRelPath('crawler') . 'icon_tx_crawler_configuration.gif" border="0" align="top" alt="" />'), $onClick, 0);
}
return array_merge($menuItems, $localItems);
}
示例10: handleNoNewsFoundError
/**
* Error handling if no news entry is found
*
* @param string $configuration configuration what will be done
* @throws InvalidArgumentException
* @return void
*/
protected function handleNoNewsFoundError($configuration)
{
if (empty($configuration)) {
return;
}
$configuration = t3lib_div::trimExplode(',', $configuration, TRUE);
switch ($configuration[0]) {
case 'redirectToListView':
$this->redirect('list');
break;
case 'redirectToPage':
if (count($configuration) === 1 || count($configuration) > 3) {
$msg = sprintf('If error handling "%s" is used, either 2 or 3 arguments, splitted by "," must be used', $configuration[0]);
throw new InvalidArgumentException($msg);
}
/** @var $cObj tslib_cObj */
$cObj = t3lib_div::makeInstance('tslib_cObj');
$url = $cObj->typoLink_URL(array('parameter' => $configuration[1]));
if (isset($configuration[2])) {
$header = 'HTTP_STATUS_' . $configuration[2];
t3lib_utility_Http::redirect($url, $header);
} else {
t3lib_utility_Http::redirect($url);
}
break;
case 'pageNotFoundHandler':
$GLOBALS['TSFE']->pageNotFoundAndExit('No news entry found.');
break;
default:
// Do nothing, it might be handled in the view.
}
}
示例11: main
function main($linktxt, $conf, $linkHandlerKeyword, $linkHandlerValue, $link_param, &$pObj)
{
$this->pObj =& $pObj;
$pageTSConfig = $GLOBALS['TSFE']->getPagesTSconfig($GLOBALS['TSFE']->id);
$linkConfig = $pageTSConfig['RTE.']['default.']['linkhandler.'];
if (!is_array($linkConfig)) {
return $linktxt;
}
$linkHandlerData = t3lib_div::trimExplode(':', $linkHandlerValue);
if (!isset($linkConfig[$linkHandlerData[0] . '.'])) {
return $linktxt;
}
$localcObj = t3lib_div::makeInstance('tslib_cObj');
$row = $this->getRecordRow($linkHandlerData[0], $linkHandlerData[1]);
$localcObj->start($row, '');
$lconf = array();
if (is_array($linkConfig[$linkHandlerData[0] . '.'][$row['pid'] . '.'])) {
$lconf = $linkConfig[$linkHandlerData[0] . '.'][$row['pid'] . '.'];
} else {
$lconf = $linkConfig[$linkHandlerData[0] . '.']['default.'];
}
$link_paramA = t3lib_div::unQuoteFilenames($link_param, true);
$linkClass = $link_paramA[2] == '-' ? '' : $link_paramA[2];
$lconf['ATagParams'] = $this->pObj->getATagParams($conf) . ($linkClass ? ' class="' . $linkClass . '"' : '');
if ($link_paramA[3]) {
$lconf['title'] = $link_paramA[3];
}
// remove the tinymce_rte specific attributes
unset($lconf['select'], $lconf['sorting']);
return $localcObj->typoLink($linktxt, $lconf);
}
示例12: check
/**
* Validates that a specified field's value is a valid date
*
* @param array &$check The TypoScript settings for this error check
* @param string $name The field name
* @param array &$gp The current GET/POST parameters
* @return string The error string
*/
public function check(&$check, $name, &$gp)
{
$checkFailed = '';
if (isset($gp[$name]) && strlen(trim($gp[$name])) > 0) {
# find out separator
$pattern = Tx_Formhandler_StaticFuncs::getSingle($check['params'], 'pattern');
preg_match('/^[d|m|y]*(.)[d|m|y]*/i', $pattern, $res);
$sep = $res[1];
// normalisation of format
$pattern = $this->normalizeDatePattern($pattern, $sep);
// find out correct positioins of "d","m","y"
$pos1 = strpos($pattern, 'd');
$pos2 = strpos($pattern, 'm');
$pos3 = strpos($pattern, 'y');
$dateCheck = t3lib_div::trimExplode($sep, $gp[$name]);
if (sizeof($dateCheck) !== 3) {
$checkFailed = $this->getCheckFailed($check);
} elseif (intval($dateCheck[0]) === 0 || intval($dateCheck[1]) === 0 || intval($dateCheck[2]) === 0) {
$checkFailed = $this->getCheckFailed($check);
} elseif (!checkdate($dateCheck[$pos2], $dateCheck[$pos1], $dateCheck[$pos3])) {
$checkFailed = $this->getCheckFailed($check);
} elseif (strlen($dateCheck[$pos3]) !== 4) {
$checkFailed = $this->getCheckFailed($check);
}
}
return $checkFailed;
}
示例13: getExtensionSummary
/**
* Returns information about this extension's pi1 plugin
*
* @param array $params Parameters to the hook
* @param mixed $pObj A reference to calling object
* @return string Information about pi1 plugin
*/
public function getExtensionSummary(array $params, $pObj)
{
$result = $actionTranslationKey = '';
if ($this->showExtensionTitle()) {
$result .= '<strong>' . $GLOBALS['LANG']->sL(self::LLPATH . 'pi1_title', TRUE) . '</strong>';
}
if ($params['row']['list_type'] == self::KEY . '_pi1') {
$this->flexformData = t3lib_div::xml2array($params['row']['pi_flexform']);
// if flexform data is found
$actions = $this->getFieldFromFlexform($this->flexformData, 'switchableControllerActions');
if (!empty($actions)) {
$actionList = t3lib_div::trimExplode(';', $actions);
// translate the first action into its translation
$actionTranslationKey = strtolower(str_replace('->', '_', $actionList[0]));
$actionTranslation = $GLOBALS['LANG']->sL(self::LLPATH . 'flexforms_general.mode.' . $actionTranslationKey);
$result .= '<h5>' . $actionTranslation . '</h5>';
} else {
$result = $GLOBALS['LANG']->sL(self::LLPATH . 'flexforms_general.mode.not_configured');
}
if (is_array($this->flexformData)) {
switch ($actionTranslationKey) {
case 'news_list':
$this->getStartingPoint();
$this->getTimeRestrictionSetting();
$this->getTopNewsRestrictionSetting();
$this->getOrderSettings();
$this->getCategorySettings();
$this->getArchiveSettings();
$this->getOffsetLimitSettings();
$this->getDetailPidSetting();
$this->getListPidSetting();
break;
case 'news_detail':
$this->getSingleNewsSettings();
$this->getDetailPidSetting();
break;
case 'news_datemenu':
$this->getStartingPoint();
$this->getTimeRestrictionSetting();
$this->getTopNewsRestrictionSetting();
$this->getDateMenuSettings();
$this->getCategorySettings();
break;
case 'category_list':
$this->getCategorySettings(FALSE);
break;
case 'tag_list':
$this->getStartingPoint(FALSE);
$this->getListPidSetting();
break;
default:
}
// for all views
$this->getOverrideDemandSettings();
$this->getTemplateLayoutSettings();
$result .= $this->renderSettingsAsTable($params['row']);
}
}
return $result;
}
示例14: test
function test($urls,$config,$title,$displayOnlyOnStateNo=0) {
// Init object:
$urlObj = t3lib_div::makeInstance('tx_realurl');
$urlObj->extConf = $config;
// Traverse URLs:
$urls = t3lib_div::trimExplode(chr(10),$urls,1);
$resultPairs = array();
foreach($urls as $k => $singleUrl) {
// Encode:
$uParts = parse_url($singleUrl);
$SpURL = $urlObj->encodeSpURL_doEncode($uParts['query']);
// Decode:
$uParts = parse_url($SpURL);
$GETvars = $urlObj->decodeSpURL_doDecode($uParts['path']);
$remainingP = $uParts['query'];
list(,$origP) = explode('?',$singleUrl,2);
$origP = orderParameters($origP);
$vars = orderParameters('id='.$GETvars['id'].($remainingP ? '&'.$remainingP : '').t3lib_div::implodeArrayForUrl('', $GETvars['GET_VARS'], '', 0, 1));
$stateNo = $origP!=$vars;
if ($stateNo || !$displayOnlyOnStateNo)
$resultPairs[$k] = array($singleUrl, $SpURL, $GETvars, $origP, $vars, $stateNo ? 'NO!!' : 'YES');
}
debug($resultPairs,$title);
}
示例15: main
/**
* Default action.
*
* @return array
* @throws RuntimeException
*/
public function main()
{
$this->init();
$allowedIps = t3lib_div::trimExplode(',', $this->config['allowedIps'], true);
if ($this->config['debug']) {
t3lib_div::sysLog('Connection from ' . t3lib_div::getIndpEnv('REMOTE_ADDR'), self::$extKey);
}
if ($this->config['mode'] !== 'M' || count($allowedIps) && !t3lib_div::inArray($allowedIps, t3lib_div::getIndpEnv('REMOTE_ADDR'))) {
$this->denyAccess();
}
$this->initTSFE();
if (!empty($this->config['synchronizeDeletedAccounts']) && $this->config['synchronizeDeletedAccounts']) {
$additionalFields = ', deleted';
$additionalWhere = '';
} else {
$additionalFields = '';
$additionalWhere = ' AND deleted=0';
}
$administrators = $this->getDatabaseConnection()->exec_SELECTgetRows('username, admin, disable, realName, email, TSconfig, starttime, endtime, lang, tx_openid_openid' . $additionalFields, 'be_users', 'admin=1 AND tx_openid_openid<>\'\'' . $additionalWhere);
if (count($administrators)) {
$key = $this->config['preSharedKey'];
$data = json_encode($administrators);
$encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $data, MCRYPT_MODE_CBC, md5(md5($key)));
$encrypted = base64_encode($encrypted);
return $encrypted;
} else {
throw new RuntimeException('No administrators found', 1327586994);
}
}