本文整理汇总了PHP中TYPO3\CMS\Core\Utility\GeneralUtility::intExplode方法的典型用法代码示例。如果您正苦于以下问题:PHP GeneralUtility::intExplode方法的具体用法?PHP GeneralUtility::intExplode怎么用?PHP GeneralUtility::intExplode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\GeneralUtility
的用法示例。
在下文中一共展示了GeneralUtility::intExplode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findDemanded
/**
* Returns banners matching the given demand
*
* @param \DERHANSEN\SfBanners\Domain\Model\BannerDemand $demand The demand
* @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
*/
public function findDemanded(BannerDemand $demand)
{
/* Override the default sorting for random mode. Must be called before
createQuery() */
if ($demand->getDisplayMode() == 'allRandom') {
$this->defaultOrderings = array();
}
$query = $this->createQuery();
$constraints = array();
if ($demand->getStartingPoint() != 0) {
$pidList = GeneralUtility::intExplode(',', $demand->getStartingPoint(), true);
$constraints[] = $query->in('pid', $pidList);
}
if ($demand->getCategories() != 0) {
$categoryConstraints = array();
$categories = GeneralUtility::intExplode(',', $demand->getCategories(), true);
foreach ($categories as $category) {
$categoryConstraints[] = $query->contains('category', $category);
}
if (count($categoryConstraints) > 0) {
$constraints[] = $query->logicalOr($categoryConstraints);
}
}
$query->matching($query->logicalAnd($constraints));
/* Get banners without respect to limitations */
$unfilteredResult = $query->execute();
if ($unfilteredResult->count() > 0) {
$finalQuery = $this->getQueryWithLimitation($unfilteredResult, $demand);
$result = $this->getResult($finalQuery, $demand);
} else {
$result = $unfilteredResult;
}
return $result;
}
示例2: initializeAction
/**
* Initializes the controller before invoking an action method.
*
* @return void
*/
public function initializeAction()
{
if ($this->request->getPluginName() === 'Administration') {
$this->logInUserRole = new Model\LoginUserRole();
if ($this->getTypoScriptFrontendController()->loginUser) {
$investigators = CoreUtility\GeneralUtility::intExplode(',', $this->settings['investigator'], true);
$administrators = CoreUtility\GeneralUtility::intExplode(',', $this->settings['administrator'], true);
// Check investigator access
if (in_array((int) $this->getTypoScriptFrontendController()->fe_user->user[$this->getTypoScriptFrontendController()->fe_user->userid_column], $investigators)) {
$this->logInUserRole = new Model\LoginUserRole(Model\LoginUserRole::INVESTIGATOR);
}
// Check administrator access
if (in_array((int) $this->getTypoScriptFrontendController()->fe_user->user[$this->getTypoScriptFrontendController()->fe_user->userid_column], $administrators)) {
$this->logInUserRole = new Model\LoginUserRole(Model\LoginUserRole::ADMINISTRATOR);
}
}
if ($this->logInUserRole->isNotAuthorized()) {
$this->getTypoScriptFrontendController()->pageNotFoundAndExit();
} elseif ($this->logInUserRole->isInvestigator() && in_array($this->request->getControllerActionName(), $this->adminActions)) {
$this->getTypoScriptFrontendController()->pageNotFoundAndExit();
}
}
$settings = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['project_registration']);
$this->settings['warnXDaysBeforeExpireDate'] = $settings['warnXDaysBeforeExpireDate'];
if (in_array($this->request->getControllerActionName(), $this->actionsThatRequireProjectArgumentToBeSet)) {
$this->manuallySetProjectArgument();
}
}
示例3: createQuery
/**
* Returns a query for objects of this repository
*
* @return Tx_Extbase_Persistence_QueryInterface
*/
public function createQuery()
{
$query = parent::createQuery();
$constraints = array();
if (!empty($this->queryOffset)) {
$query->setOffset((int) $this->queryOffset);
}
if (!empty($this->queryLimit)) {
$query->setLimit((int) $this->queryLimit);
}
if (!empty($this->queryOrderings)) {
$query->setOrderings($this->queryOrderings);
}
if (!empty($this->storagePage)) {
$query->getQuerySettings()->setRespectStoragePage(false);
$pidList = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', Tx_T3devapi_Utility_Page::extendPidListByChildren($this->storagePage, 9999), true);
$constraints[] = $query->in('pid', $pidList);
}
if (!empty($this->uidList)) {
$uidList = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $this->uidList, true);
$constraints[] = $query->in('uid', $uidList);
}
$constraints = $this->setSearchConstraints($query, $constraints);
if (!empty($constraints)) {
$query->matching($query->logicalAnd($constraints));
}
return $query;
}
示例4: connect
/**
*
*/
public function connect()
{
$this->ssh = new SSH2($this->configuration['hostname'], $this->configuration['port']);
$authenticationMethod = $this->configuration[SftpDriver::CONFIG_AUTHENTICATION_METHOD];
if (static::AUTHENTICATION_PASSWORD === (int) $authenticationMethod) {
$authentication = $this->configuration['password'];
} elseif (static::AUTHENTICATION_PUBKEY === (int) $authenticationMethod) {
$authentication = new RSA();
if (!empty($this->configuration['privateKeyPassword'])) {
$authentication->setPassword($this->configuration['privateKeyPassword']);
}
$authentication->loadKey(file_get_contents($this->configuration['privateKey']));
} else {
throw new \LogicException('Wrong authentication type for phpseclibAdapter', 1476626149);
}
$sshConnected = $this->ssh->login($this->configuration['username'], $authentication);
if ($sshConnected) {
$this->sftp = new SFTP($this->configuration['hostname'], $this->configuration['port']);
$sftpConnected = $this->sftp->login($this->configuration['username'], $authentication);
if ($sftpConnected) {
$this->info['userId'] = (int) $this->ssh->exec('echo $EUID');
$this->info['groupIds'] = GeneralUtility::intExplode(' ', $this->ssh->exec('echo ${GROUPS[*]}'), true);
return true;
}
}
return false;
}
示例5: process
/**
* Process field data to split in an array
*
* @param ContentObjectRenderer $cObj The data of the content element or page
* @param array $contentObjectConfiguration The configuration of Content Object
* @param array $processorConfiguration The configuration of this processor
* @param array $processedData Key/value store of processed data (e.g. to be passed to a Fluid View)
* @return array the processed data as key/value store
*/
public function process(ContentObjectRenderer $cObj, array $contentObjectConfiguration, array $processorConfiguration, array $processedData)
{
if (isset($processorConfiguration['if.']) && !$cObj->checkIf($processorConfiguration['if.'])) {
return $processedData;
}
// The field name to process
$fieldName = $cObj->stdWrapValue('fieldName', $processorConfiguration);
if (empty($fieldName)) {
return $processedData;
}
$originalValue = $cObj->data[$fieldName];
// Set the target variable
$targetVariableName = $cObj->stdWrapValue('as', $processorConfiguration, $fieldName);
// Set the delimiter which is "LF" by default
$delimiter = $cObj->stdWrapValue('delimiter', $processorConfiguration, LF);
// Filter integers
$filterIntegers = (bool) $cObj->stdWrapValue('filterIntegers', $processorConfiguration, false);
// Filter unique
$filterUnique = (bool) $cObj->stdWrapValue('filterUnique', $processorConfiguration, false);
// Remove empty entries
$removeEmptyEntries = (bool) $cObj->stdWrapValue('removeEmptyEntries', $processorConfiguration, false);
if ($filterIntegers === true) {
$processedData[$targetVariableName] = GeneralUtility::intExplode($delimiter, $originalValue, $removeEmptyEntries);
} else {
$processedData[$targetVariableName] = GeneralUtility::trimExplode($delimiter, $originalValue, $removeEmptyEntries);
}
if ($filterUnique === true) {
$processedData[$targetVariableName] = array_unique($processedData[$targetVariableName]);
}
return $processedData;
}
示例6: findByUids
/**
* Get a list of addresses.
*
* @param string $uids A comma separeted list of uids
*
* @return QueryResultInterface|array
*/
public function findByUids($uids)
{
$query = $this->createQuery();
$query->getQuerySettings()->setRespectStoragePage(false);
$query->matching($query->in('uid', GeneralUtility::intExplode(',', $uids)));
return $query->execute();
}
示例7: teaserAction
/**
* Render the teaser action
*
* @cache 1h
*/
public function teaserAction()
{
$topQuestions = GeneralUtility::intExplode(',', $this->settings['faq']['topQuestions'], true);
$teaserCategories = GeneralUtility::intExplode(',', $this->settings['faq']['teaserCategories'], true);
$teaserLimit = (int) $this->settings['faq']['teaserLimit'];
$questions = $this->questionRepository->findByTeaserConfiguration($topQuestions, $teaserCategories, $teaserLimit);
$this->view->assign('questions', $questions);
}
示例8: findByPidsAndAuthor
/**
* Find notes by given pids and author
*
* @param string $pids Single PID or comma separated list of PIDs
* @param \TYPO3\CMS\Extbase\Domain\Model\BackendUser $author The author
* @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface
*/
public function findByPidsAndAuthor($pids, \TYPO3\CMS\Extbase\Domain\Model\BackendUser $author)
{
$pids = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', (string) $pids);
$query = $this->createQuery();
$query->setOrderings(array('sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING, 'creationDate' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING));
$query->matching($query->logicalAnd($query->in('pid', $pids), $query->logicalOr($query->equals('personal', 0), $query->equals('author', $author))));
return $query->execute();
}
示例9: findByUidList
/**
* @param $uidList
*
* @return array|NULL
* @throws \Exception
*/
public function findByUidList($uidList)
{
$list = implode(',', GeneralUtility::intExplode(',', $uidList, 1));
if ($list != '') {
return $this->getDb()->exec_SELECTgetRows('*', $this->getTable(), 'uid IN (' . $list . ')' . DatabaseFactory::enableFields($this->getTable()), '', 'FIELD(uid, ' . $list . ')');
} else {
return array();
}
}
示例10: generateSitemapContent
/**
* Generates extension site map.
*
* @return void
*/
protected function generateSitemapContent()
{
$selector = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('selector'));
$typoscriptSelector = $selector . '.';
$currentSetup = $GLOBALS['TSFE']->tmpl->setup['plugin.']['dd_googlesitemap_dmf.'][$typoscriptSelector];
$pidList = $currentSetup['pidList'] ? \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $currentSetup['pidList']) : $this->pidList;
$catList = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('catList') ? \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('catList')) : \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $currentSetup['catList']);
$catMMList = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('catMMList') ? \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('catMMList')) : \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $currentSetup['catMMList']);
$currentSetup['singlePid'] = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('singlePid') ? intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('singlePid')) : intval($currentSetup['singlePid']);
$currentSetup['languageUid'] = '';
if (!$currentSetup['disableLanguageCheck']) {
if (is_int($GLOBALS['TSFE']->sys_language_uid)) {
// set language through TSFE checkup
$currentSetup['languageUid'] = intval($GLOBALS['TSFE']->sys_language_uid);
}
if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('L')) {
// overwrites if L param is set
$currentSetup['languageUid'] = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('L'));
}
}
if (count($pidList) > 0 && isset($selector) && isset($currentSetup)) {
$table = $currentSetup['sqlMainTable'];
$mmTable = $currentSetup['sqlMMTable'];
$catColumn = $currentSetup['sqlCatColumn'];
$sqlCondition = $catColumn && count($catList) > 0 && $catList[0] > 0 ? ' AND ' . $catColumn . ' IN (' . implode(',', $catList) . ')' : '';
$sqlMMCondition = $sqlMMTable = '';
if ($mmTable != '' && count($catMMList) > 0 && $catMMList[0] > 0) {
$sqlMMTable = ',' . $mmTable;
$sqlMMCondition = ' AND ' . $table . '.uid = ' . $mmTable . '.uid_local AND ' . $mmTable . '.uid_foreign IN (' . implode(',', $catMMList) . ')';
}
$newsSelect = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('type') == 'news' ? ',' . $currentSetup['sqlTitle'] . ',' . $currentSetup['sqlKeywords'] : '';
$languageWhere = is_int($currentSetup['languageUid']) ? ' AND ' . $table . '.sys_language_uid=' . $currentSetup['languageUid'] : '';
if ($table == 'tx_news_domain_model_news') {
$noInternalURLwhere = ' AND (' . $table . '.internalurl=FALSE OR ' . $table . ' .internalurl IS NULL)';
$noExternalURLwhere = ' AND (' . $table . '.externalurl=FALSE OR ' . $table . ' .externalurl IS NULL)';
} else {
$noInternalURLwhere = '';
$noExternalURLwhere = '';
}
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,' . $currentSetup['sqlLastUpdated'] . $newsSelect, $table . $sqlMMTable, 'pid IN (' . implode(',', $pidList) . ')' . $sqlCondition . $sqlMMCondition . $this->cObj->enableFields($table) . $languageWhere . $noInternalURLwhere . $noExternalURLwhere, 'uid', $currentSetup['sqlOrder'] ? $currentSetup['sqlOrder'] : '');
$rowCount = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
while (FALSE !== ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))) {
if ($url = $this->getVariousItemUrl($row['uid'], $currentSetup)) {
$frequency = $currentSetup['frequency'] ? $currentSetup['frequency'] : $this->getChangeFrequency($row[$currentSetup['sqlLastUpdated']]);
echo $this->renderer->renderEntry($url, $row[$currentSetup['sqlTitle']], $row[$currentSetup['sqlLastUpdated']], $frequency, $row[$currentSetup['sqlKeywords']]);
}
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
if ($rowCount === 0) {
echo '<!-- It appears that there are no extension entries. If your ' . 'storage sysfolder is outside of the rootline, you may ' . 'want to use the dd_googlesitemap.skipRootlineCheck=1 TS ' . 'setup option. Beware: it is insecure and may cause certain ' . 'undesired effects! Better move your pid sysfolder ' . 'inside the rootline! -->';
} elseif (!$rowCount) {
echo '<!-- There is an sql error. please check all corresponding sql fields in your typoscript setup. -->';
}
} else {
echo 'There is something wrong with the config. Please check your selector and pidList elements. You may ' . 'want to use the dd_googlesitemap.skipRootlineCheck=1 TS ' . 'setup option if your storage sysfolder is outside the rootline. Beware: it is insecure and may cause certain ' . 'undesired effects! Better move your pid sysfolder ' . 'inside the rootline! -->';
}
}
示例11: findByUids
/**
* Find Form objects by its given uids
*
* @param string $uids commaseparated list of uids
* @return \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult
*/
public function findByUids($uids)
{
$query = $this->createQuery();
$query->getQuerySettings()->setRespectStoragePage(FALSE);
$query->getQuerySettings()->setRespectSysLanguage(FALSE);
$query->matching($query->in('uid', GeneralUtility::intExplode(',', $uids, TRUE)));
$result = $query->execute();
return $result;
}
示例12: findByUidList
/**
* @param $uidList
*
* @return array|NULL
* @throws \Exception
*/
public function findByUidList($uidList)
{
$list = implode(',', GeneralUtility::intExplode(',', $uidList, 1));
if ($list != '') {
return $this->getDb()->exec_SELECTgetRows('*', $this->getTable(), 'uid IN (' . $list . ')' . DatabaseFactory::enableFields($this->getTable()), '', 'FIELD(uid, ' . $list . ')');
} else {
throw new \Exception('Given uid list does not contain uids! Table: ' . $this->getTable());
}
}
示例13: findByStartingPoint
/**
* @param $pidList
* @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface
*/
public function findByStartingPoint($pidList)
{
$query = $this->getQuery();
$pidList = GeneralUtility::intExplode(',', $pidList, TRUE);
if (!empty($pidList)) {
return $query->matching($query->logicalAnd($query->in('pid', $pidList)))->execute();
}
return $query->execute();
}
示例14: sortExplode
/**
* Explodes a comma-separated list of integer values and sorts them
* numerically.
*
* @param string $valueList comma-separated list of values, may be empty
*
* @return int[] the separate values, sorted numerically, may be empty
*/
private function sortExplode($valueList)
{
if ($valueList == '') {
return array();
}
$numbers = GeneralUtility::intExplode(',', $valueList);
sort($numbers, SORT_NUMERIC);
return $numbers;
}
示例15: findByUids
/**
* Find by list or array or uids
*
* @param array|string $uids
*
* @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
*/
public function findByUids($uids)
{
$query = $this->createQuery();
if (!is_array($uids)) {
$uids = GeneralUtility::intExplode(',', $uids);
}
$query->setOrderings(array('sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING));
$query->matching($query->in('uid', $uids));
return $query->execute();
}