本文整理汇总了PHP中t3lib_div::array_merge方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_div::array_merge方法的具体用法?PHP t3lib_div::array_merge怎么用?PHP t3lib_div::array_merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_div
的用法示例。
在下文中一共展示了t3lib_div::array_merge方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array_merge
/**
* @param array $arr1 First array
* @param array $arr2 Second array
* @return array Merged result.
*/
public function array_merge(array $arr1, array $arr2)
{
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::array_merge($arr1, $arr2);
}
示例2: searchTitle_searchPid
/**
* Search for a title in a certain PID
*
* @param integer Page id in which to search subpages matching title
* @param string Title to search for
* @return array First entry is uid, second entry is the row selected, including information about the page as a mount point.
* @access private
* @see searchTitle()
*/
function searchTitle_searchPid($searchPid, $title) {
// List of "pages" fields to traverse for a "directory title" in the speaking URL (only from RootLine!!):
$segTitleFieldList = $this->conf['segTitleFieldList'] ? $this->conf['segTitleFieldList'] : TX_REALURL_SEGTITLEFIELDLIST_DEFAULT;
$selList = t3lib_div::uniqueList('uid,pid,doktype,mount_pid,mount_pid_ol,tx_realurl_exclude,' . $segTitleFieldList);
$segTitleFieldArray = t3lib_div::trimExplode(',', $segTitleFieldList, 1);
// page select object - used to analyse mount points.
$sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
// Build an array with encoded values from the segTitleFieldArray of the subpages
// First we find field values from the default language
// Pages are selected in menu order and if duplicate titles are found the first takes precedence!
$titles = array(); // array(title => uid);
$exclude = array();
$uidTrack = array();
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($selList, 'pages',
'pid=' . intval($searchPid) .
' AND deleted=0 AND doktype!=255', '', 'sorting');
while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result))) {
// Mount points:
$mount_info = $sys_page->getMountPointInfo($row['uid'], $row);
if (is_array($mount_info)) {
// There is a valid mount point.
if ($mount_info['overlay']) {
// Overlay mode: Substitute WHOLE record:
$result2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery($selList, 'pages',
'uid=' . intval($mount_info['mount_pid']) .
' AND deleted=0 AND doktype!=255');
$mp_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result2);
if (is_array($mp_row)) {
$row = $mp_row;
}
else {
unset($row); // If the mount point could not be fetched, unset the row
}
}
$row['_IS_MOUNTPOINT'] = $mount_info;
}
// Collect titles from selected row:
if (is_array($row)) {
if ($row['tx_realurl_exclude']) {
// segment is excluded
$exclude[] = $row;
}
// Process titles. Note that excluded segments are also searched
// otherwise they will never be found
$uidTrack[$row['uid']] = $row;
foreach ($segTitleFieldArray as $fieldName) {
if ($row[$fieldName]) {
$encodedTitle = $this->encodeTitle($row[$fieldName]);
if (!isset($titles[$fieldName][$encodedTitle])) {
$titles[$fieldName][$encodedTitle] = $row['uid'];
}
}
}
}
}
$GLOBALS['TYPO3_DB']->sql_free_result($result);
// We have to search the language overlay too, if: a) the language isn't the default (0), b) if it's not set (-1)
$uidTrackKeys = array_keys($uidTrack);
foreach ($uidTrackKeys as $l_id) {
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(TX_REALURL_SEGTITLEFIELDLIST_PLO,
'pages_language_overlay', 'pid=' . intval($l_id) . ' AND deleted=0');
while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result))) {
foreach ($segTitleFieldArray as $fieldName) {
if ($row[$fieldName]) {
$encodedTitle = $this->encodeTitle($row[$fieldName]);
if (!isset($titles[$fieldName][$encodedTitle])) {
$titles[$fieldName][$encodedTitle] = $l_id;
}
}
}
}
$GLOBALS['TYPO3_DB']->sql_free_result($result);
}
// Merge titles:
$segTitleFieldArray = array_reverse($segTitleFieldArray); // To observe the priority order...
$allTitles = array();
foreach ($segTitleFieldArray as $fieldName) {
if (is_array($titles[$fieldName])) {
$allTitles = t3lib_div::array_merge($allTitles, $titles[$fieldName]);
}
}
// Return:
$encodedTitle = $this->encodeTitle($title);
//.........这里部分代码省略.........
示例3: indexAction
/**
* Overview About Sitemaps
*/
public function indexAction()
{
$pages = $this->getBasePages();
$providers = t3lib_div::trimExplode(',', $this->settings['provider'], TRUE);
$nodes = array();
foreach ($providers as $provider) {
$provider = Tx_GoogleServices_Service_SitemapProvider::getProvider($provider);
$providerNodes = $provider->getRecords(intval($this->settings['startpoint']), $pages, $this);
$nodes = t3lib_div::array_merge($nodes, $providerNodes);
}
$this->prepareAndAssignNodes($nodes);
}
示例4: menuConfig
/**
* Adds items to the ->MOD_MENU array. Used for the function menu selector.
*
* @return void
*/
function menuConfig()
{
global $LANG;
$this->MOD_MENU = array('users' => array('-1' => $LANG->getLL('loggedInUsers'), '0' => $LANG->getLL('notLoggedIn'), '' => '------------------------------'), 'mode' => array('-1' => $LANG->getLL('allTime'), '1' => $LANG->getLL('byTime')));
foreach (t3lib_BEfunc::getRecordsByField('fe_users', 1, 1) as $user) {
$this->MOD_MENU['users'][$user['uid']] = $user['username'];
}
parent::menuConfig();
$set = t3lib_div::_GP('SET');
if ($set['time']) {
$dateFrom = strtotime($set['time']['from']);
$dateTo = strtotime($set['time']['to']);
$set['time']['from'] = $dateFrom > 0 ? date('d.m.Y', $dateFrom) : '';
$set['time']['to'] = $dateTo > 0 ? date('d.m.Y', $dateTo) : '';
$mergedSettings = t3lib_div::array_merge($this->MOD_SETTINGS, $set);
$GLOBALS['BE_USER']->pushModuleData($this->MCONF['name'], $mergedSettings);
$this->MOD_SETTINGS = $mergedSettings;
}
}
示例5: _ACTION_FLEX_FORMdata
/**
* Actions for flex form element (move, delete)
*
* @param array &$valueArrayToRemoveFrom: by reference
* @param array $deleteCMDS: ... *
* @return void
*/
function _ACTION_FLEX_FORMdata(&$valueArray, $actionCMDs)
{
if (is_array($valueArray) && is_array($actionCMDs)) {
foreach ($actionCMDs as $key => $value) {
if ($key == '_ACTION') {
// First, check if there are "commands":
if (current($actionCMDs[$key]) !== "") {
asort($actionCMDs[$key]);
$newValueArray = array();
foreach ($actionCMDs[$key] as $idx => $order) {
if (substr($idx, 0, 3) == "ID-") {
$idx = $this->newIndexMap[$idx];
}
if ($order != "DELETE") {
// Just one reflection here: It is clear that when removing elements from a flexform, then we will get lost files unless we act on this delete operation by traversing and deleting files that were referred to.
$newValueArray[$idx] = $valueArray[$idx];
}
unset($valueArray[$idx]);
}
$valueArray = t3lib_div::array_merge($newValueArray, $valueArray);
}
} elseif (is_array($actionCMDs[$key]) && isset($valueArray[$key])) {
$this->_ACTION_FLEX_FORMdata($valueArray[$key], $actionCMDs[$key]);
}
}
}
}
示例6: processAjaxRequest
/**
* Ajax handler for the "suggest" feature in TCEforms.
*
* @param array $params The parameters from the AJAX call
* @param TYPO3AJAX $ajaxObj The AJAX object representing the AJAX call
* @return void
*/
public function processAjaxRequest($params, &$ajaxObj)
{
// get parameters from $_GET/$_POST
$search = t3lib_div::_GP('value');
$table = t3lib_div::_GP('table');
$field = t3lib_div::_GP('field');
$uid = t3lib_div::_GP('uid');
$pageId = t3lib_div::_GP('pid');
t3lib_div::loadTCA($table);
// If the $uid is numeric, we have an already existing element, so get the
// TSconfig of the page itself or the element container (for non-page elements)
// otherwise it's a new element, so use given id of parent page (i.e., don't modify it here)
if (is_numeric($uid)) {
if ($table == 'pages') {
$pageId = $uid;
} else {
$row = t3lib_BEfunc::getRecord($table, $uid);
$pageId = $row['pid'];
}
}
$TSconfig = t3lib_BEfunc::getPagesTSconfig($pageId);
$queryTables = array();
$foreign_table_where = '';
$wizardConfig = $GLOBALS['TCA'][$table]['columns'][$field]['config']['wizards']['suggest'];
if (isset($GLOBALS['TCA'][$table]['columns'][$field]['config']['allowed'])) {
$queryTables = t3lib_div::trimExplode(',', $GLOBALS['TCA'][$table]['columns'][$field]['config']['allowed']);
} elseif (isset($GLOBALS['TCA'][$table]['columns'][$field]['config']['foreign_table'])) {
$queryTables = array($GLOBALS['TCA'][$table]['columns'][$field]['config']['foreign_table']);
$foreign_table_where = $GLOBALS['TCA'][$table]['columns'][$field]['config']['foreign_table_where'];
// strip ORDER BY clause
$foreign_table_where = trim(preg_replace('/ORDER[[:space:]]+BY.*/i', '', $foreign_table_where));
}
$resultRows = array();
// fetch the records for each query table. A query table is a table from which records are allowed to
// be added to the TCEForm selector, originally fetched from the "allowed" config option in the TCA
foreach ($queryTables as $queryTable) {
t3lib_div::loadTCA($queryTable);
// if the table does not exist, skip it
if (!is_array($GLOBALS['TCA'][$queryTable]) || !count($GLOBALS['TCA'][$queryTable])) {
continue;
}
$config = (array) $wizardConfig['default'];
if (is_array($wizardConfig[$queryTable])) {
$config = t3lib_div::array_merge_recursive_overrule($config, $wizardConfig[$queryTable]);
}
// merge the configurations of different "levels" to get the working configuration for this table and
// field (i.e., go from the most general to the most special configuration)
if (is_array($TSconfig['TCEFORM.']['suggest.']['default.'])) {
$config = t3lib_div::array_merge_recursive_overrule($config, $TSconfig['TCEFORM.']['suggest.']['default.']);
}
if (is_array($TSconfig['TCEFORM.']['suggest.'][$queryTable . '.'])) {
$config = t3lib_div::array_merge_recursive_overrule($config, $TSconfig['TCEFORM.']['suggest.'][$queryTable . '.']);
}
// use $table instead of $queryTable here because we overlay a config
// for the input-field here, not for the queried table
if (is_array($TSconfig['TCEFORM.'][$table . '.'][$field . '.']['suggest.']['default.'])) {
$config = t3lib_div::array_merge_recursive_overrule($config, $TSconfig['TCEFORM.'][$table . '.'][$field . '.']['suggest.']['default.']);
}
if (is_array($TSconfig['TCEFORM.'][$table . '.'][$field . '.']['suggest.'][$queryTable . '.'])) {
$config = t3lib_div::array_merge_recursive_overrule($config, $TSconfig['TCEFORM.'][$table . '.'][$field . '.']['suggest.'][$queryTable . '.']);
}
//process addWhere
if (!isset($config['addWhere']) && $foreign_table_where) {
$config['addWhere'] = $foreign_table_where;
}
if (isset($config['addWhere'])) {
$config['addWhere'] = strtr(' ' . $config['addWhere'], array('###THIS_UID###' => intval($uid), '###CURRENT_PID###' => intval($pageId)));
}
// instantiate the class that should fetch the records for this $queryTable
$receiverClassName = $config['receiverClass'];
if (!class_exists($receiverClassName)) {
$receiverClassName = 't3lib_TCEforms_Suggest_DefaultReceiver';
}
$receiverObj = t3lib_div::makeInstance($receiverClassName, $queryTable, $config);
$params = array('value' => $search);
$rows = $receiverObj->queryTable($params);
if (empty($rows)) {
continue;
}
$resultRows = t3lib_div::array_merge($resultRows, $rows);
unset($rows);
}
$listItems = array();
if (count($resultRows) > 0) {
// traverse all found records and sort them
$rowsSort = array();
foreach ($resultRows as $key => $row) {
$rowsSort[$key] = $row['text'];
}
asort($rowsSort);
$rowsSort = array_keys($rowsSort);
// Limit the number of items in the result list
$maxItems = $config['maxItemsInResultList'] ? $config['maxItemsInResultList'] : 10;
//.........这里部分代码省略.........
示例7: notifyStageChange
/**
* Send an email notification to users in workspace
*
* @param array $stat Workspace access array (from t3lib_userauthgroup::checkWorkspace())
* @param integer $stageId New Stage number: 0 = editing, 1= just ready for review, 10 = ready for publication, -1 = rejected!
* @param string $table Table name of element (or list of element names if $id is zero)
* @param integer $id Record uid of element (if zero, then $table is used as reference to element(s) alone)
* @param string $comment User comment sent along with action
* @param t3lib_TCEmain $tcemainObj TCEmain object
* @param string $notificationAlternativeRecipients Comma separated list of recipients to notificate instead of be_users selected by sys_workspace, list is generated by workspace extension module
* @return void
*/
protected function notifyStageChange(array $stat, $stageId, $table, $id, $comment, t3lib_TCEmain $tcemainObj, $notificationAlternativeRecipients = FALSE)
{
$workspaceRec = t3lib_BEfunc::getRecord('sys_workspace', $stat['uid']);
// So, if $id is not set, then $table is taken to be the complete element name!
$elementName = $id ? $table . ':' . $id : $table;
if (is_array($workspaceRec)) {
// Get the new stage title from workspaces library, if workspaces extension is installed
if (t3lib_extMgm::isLoaded('workspaces')) {
$stageService = t3lib_div::makeInstance('Tx_Workspaces_Service_Stages');
$newStage = $stageService->getStageTitle((int) $stageId);
} else {
// TODO: CONSTANTS SHOULD BE USED - tx_service_workspace_workspaces
// TODO: use localized labels
// Compile label:
switch ((int) $stageId) {
case 1:
$newStage = 'Ready for review';
break;
case 10:
$newStage = 'Ready for publishing';
break;
case -1:
$newStage = 'Element was rejected!';
break;
case 0:
$newStage = 'Rejected element was noticed and edited';
break;
default:
$newStage = 'Unknown state change!?';
break;
}
}
if ($notificationAlternativeRecipients == false) {
// Compile list of recipients:
$emails = array();
switch ((int) $stat['stagechg_notification']) {
case 1:
switch ((int) $stageId) {
case 1:
$emails = $this->getEmailsForStageChangeNotification($workspaceRec['reviewers']);
break;
case 10:
$emails = $this->getEmailsForStageChangeNotification($workspaceRec['adminusers'], TRUE);
break;
case -1:
# $emails = $this->getEmailsForStageChangeNotification($workspaceRec['reviewers']);
# $emails = array_merge($emails,$this->getEmailsForStageChangeNotification($workspaceRec['members']));
// List of elements to reject:
$allElements = explode(',', $elementName);
// Traverse them, and find the history of each
foreach ($allElements as $elRef) {
list($eTable, $eUid) = explode(':', $elRef);
$rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('log_data,tstamp,userid', 'sys_log', 'action=6 and details_nr=30
AND tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($eTable, 'sys_log') . '
AND recuid=' . intval($eUid), '', 'uid DESC');
// Find all implicated since the last stage-raise from editing to review:
foreach ($rows as $dat) {
$data = unserialize($dat['log_data']);
$emails = t3lib_div::array_merge($emails, $this->getEmailsForStageChangeNotification($dat['userid'], TRUE));
if ($data['stage'] == 1) {
break;
}
}
}
break;
case 0:
$emails = $this->getEmailsForStageChangeNotification($workspaceRec['members']);
break;
default:
$emails = $this->getEmailsForStageChangeNotification($workspaceRec['adminusers'], TRUE);
break;
}
break;
case 10:
$emails = $this->getEmailsForStageChangeNotification($workspaceRec['adminusers'], TRUE);
$emails = t3lib_div::array_merge($emails, $this->getEmailsForStageChangeNotification($workspaceRec['reviewers']));
$emails = t3lib_div::array_merge($emails, $this->getEmailsForStageChangeNotification($workspaceRec['members']));
break;
}
} else {
$emails = array();
foreach ($notificationAlternativeRecipients as $emailAddress) {
$emails[] = array('email' => $emailAddress);
}
}
// prepare and then send the emails
if (count($emails)) {
// Path to record is found:
//.........这里部分代码省略.........
示例8: fetchGroupData
/**
* Will select all fe_groups records that the current fe_user is member of - and which groups are also allowed in the current domain.
* It also accumulates the TSconfig for the fe_user/fe_groups in ->TSdataArray
*
* @return integer Returns the number of usergroups for the frontend users (if the internal user record exists and the usergroup field contains a value)
*/
function fetchGroupData()
{
$this->TSdataArray = array();
$this->userTS = array();
$this->userTSUpdated = 0;
$this->groupData = array('title' => array(), 'uid' => array(), 'pid' => array());
// Setting default configuration:
$this->TSdataArray[] = $GLOBALS['TYPO3_CONF_VARS']['FE']['defaultUserTSconfig'];
// get the info data for auth services
$authInfo = $this->getAuthInfoArray();
if ($this->writeDevLog) {
if (is_array($this->user)) {
t3lib_div::devLog('Get usergroups for user: ' . t3lib_div::arrayToLogString($this->user, array($this->userid_column, $this->username_column)), 'tslib_feUserAuth');
} else {
t3lib_div::devLog('Get usergroups for "anonymous" user', 'tslib_feUserAuth');
}
}
$groupDataArr = array();
// use 'auth' service to find the groups for the user
$serviceChain = '';
$subType = 'getGroups' . $this->loginType;
while (is_object($serviceObj = t3lib_div::makeInstanceService('auth', $subType, $serviceChain))) {
$serviceChain .= ',' . $serviceObj->getServiceKey();
$serviceObj->initAuth($subType, array(), $authInfo, $this);
$groupData = $serviceObj->getGroups($this->user, $groupDataArr);
if (is_array($groupData) && count($groupData)) {
$groupDataArr = t3lib_div::array_merge($groupDataArr, $groupData);
// Keys in $groupData should be unique ids of the groups (like "uid") so this function will override groups.
}
unset($serviceObj);
}
if ($this->writeDevLog and $serviceChain) {
t3lib_div::devLog($subType . ' auth services called: ' . $serviceChain, 'tslib_feUserAuth');
}
if ($this->writeDevLog and !count($groupDataArr)) {
t3lib_div::devLog('No usergroups found by services', 'tslib_feUserAuth');
}
if ($this->writeDevLog and count($groupDataArr)) {
t3lib_div::devLog(count($groupDataArr) . ' usergroup records found by services', 'tslib_feUserAuth');
}
// use 'auth' service to check the usergroups if they are really valid
foreach ($groupDataArr as $groupData) {
// by default a group is valid
$validGroup = TRUE;
$serviceChain = '';
$subType = 'authGroups' . $this->loginType;
while (is_object($serviceObj = t3lib_div::makeInstanceService('auth', $subType, $serviceChain))) {
$serviceChain .= ',' . $serviceObj->getServiceKey();
$serviceObj->initAuth($subType, array(), $authInfo, $this);
if (!$serviceObj->authGroup($this->user, $groupData)) {
$validGroup = FALSE;
if ($this->writeDevLog) {
t3lib_div::devLog($subType . ' auth service did not auth group: ' . t3lib_div::arrayToLogString($groupData, 'uid,title'), 'tslib_feUserAuth', 2);
}
break;
}
unset($serviceObj);
}
unset($serviceObj);
if ($validGroup) {
$this->groupData['title'][$groupData['uid']] = $groupData['title'];
$this->groupData['uid'][$groupData['uid']] = $groupData['uid'];
$this->groupData['pid'][$groupData['uid']] = $groupData['pid'];
$this->groupData['TSconfig'][$groupData['uid']] = $groupData['TSconfig'];
}
}
if (count($this->groupData) && count($this->groupData['TSconfig'])) {
// TSconfig: collect it in the order it was collected
foreach ($this->groupData['TSconfig'] as $TSdata) {
$this->TSdataArray[] = $TSdata;
}
$this->TSdataArray[] = $this->user['TSconfig'];
// Sort information
ksort($this->groupData['title']);
ksort($this->groupData['uid']);
ksort($this->groupData['pid']);
}
return count($this->groupData['uid']) ? count($this->groupData['uid']) : 0;
}
示例9: array
'), '199' => array('showitem' => 'doktype;;2;;1-1-1, hidden, title,
--div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.options,
TSconfig;;6;nowrap;5-5-5, storage_pid;;7,
--div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.extended,
'), '254' => array('showitem' => 'doktype;;2;;1-1-1, hidden, title;LLL:EXT:lang/locallang_general.xml:LGL.title,
--div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.files,
media,
--div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.options,
TSconfig;;6;nowrap;5-5-5, storage_pid;;7, module,
--div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.extended,
'), '255' => array('showitem' => 'doktype;;2;;1-1-1, hidden, title,
--div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.extended,
'));
// Merging palette settings:
// t3lib_div::array_merge() MUST be used - otherwise the keys will be re-numbered!
$TCA['pages']['palettes'] = t3lib_div::array_merge($TCA['pages']['palettes'], array('1' => array('showitem' => 'starttime, endtime, extendToSubpages'), '2' => array('showitem' => 'layout, lastUpdated, newUntil, no_search'), '3' => array('showitem' => 'alias, target, no_cache, cache_timeout'), '5' => array('showitem' => 'author, author_email', 'canNotCollapse' => 1)));
// if the compat version is less than 4.2, pagetype 2 ("Advanced")
// and pagetype 5 ("Not in menu") are added to TCA.
if (!t3lib_div::compat_version('4.2')) {
// Merging in CMS doktypes
array_splice($TCA['pages']['columns']['doktype']['config']['items'], 2, 0, array(array('LLL:EXT:cms/locallang_tca.xml:pages.doktype.I.0', '2', 'i/pages.gif'), array('LLL:EXT:cms/locallang_tca.xml:pages.doktype.I.3', '5', 'i/pages_notinmenu.gif')));
// setting the doktype 1 ("Standard") to show less fields
$TCA['pages']['types'][1] = array('showitem' => 'doktype;;2;;1-1-1, hidden, nav_hide, title;;3;;2-2-2, subtitle,
--div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.access,
starttime, endtime, fe_group, extendToSubpages,
--div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.options,
TSconfig;;6;nowrap;4-4-4, storage_pid;;7, l18n_cfg,
--div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.extended,
');
// adding doktype 2 ("Advanced")
$TCA['pages']['types'][2] = array('showitem' => 'doktype;;2;;1-1-1, hidden, nav_hide, title;;3;;2-2-2, subtitle, nav_title,
示例10: main
/**
* main method which controls the data flow and outputs the addresses
*
* @param string $content: content string, empty
* @param array $conf: configuration array with TS configuration
* @return string the processed addresses
*/
function main($content, $conf)
{
$this->init($conf);
$content = '';
$singleSelection = $this->getSingleRecords();
$groupSelection = $this->getRecordsFromGroups();
// merge both arrays so that we do not have any duplicates
$addresses = t3lib_div::array_merge($singleSelection, $groupSelection);
$templateCode = $this->getTemplate();
// apply sorting
if ($this->conf['sortByColumn'] === 'singleSelection' && count($groupSelection) === 0) {
// we want to sort by single selection and only have single record selection
$sortedAdressesUid = explode(',', $this->conf['singleSelection']);
$sortedAddresses = array();
foreach ($sortedAdressesUid as $uid) {
$sortedAddresses[] = $addresses[$uid];
}
$addresses = $sortedAddresses;
} else {
// if sortByColumn was set to singleSelection, but we don't have a single selection, switch to default column "name"
if ($this->conf['sortByColumn'] === 'singleSelection') {
$this->conf['sortByColumn'] = 'name';
}
// sorting the addresses by any other field
$sortBy = array();
foreach ($addresses as $k => $v) {
$sortBy[$k] = $this->normalizeSortingString($v[$this->conf['sortByColumn']]);
}
array_multisort($sortBy, $this->conf['sortOrder'], $addresses);
}
// limit output to max listMaxItems addresses
if ((int) $this->conf['listMaxItems'] > 0) {
$addresses = array_slice($addresses, 0, (int) $this->conf['listMaxItems']);
}
// output
foreach ($addresses as $address) {
if (!empty($address)) {
$markerArray = $this->getItemMarkerArray($address);
$subpartArray = $this->getSubpartArray($templateCode, $markerArray, $address);
$addressContent = $this->cObj->substituteMarkerArrayCached($templateCode, $markerArray, $subpartArray);
$wrap = $this->conf['templates.'][$this->conf['templateName'] . '.']['wrap'];
$content .= $this->cObj->wrap($addressContent, $wrap);
$content .= chr(10) . chr(10);
}
}
$templateAllWrap = $this->conf['templates.'][$this->conf['templateName'] . '.']['allWrap'];
$content = $this->cObj->wrap($content, $templateAllWrap);
$overallWrap = $this->conf['wrap'];
$content = $this->cObj->wrap($content, $overallWrap);
return $this->pi_wrapInBaseClass($content);
}
示例11: getCloudCarousel
/**
* Return the CloudCarousel for chgallery (Experimental)
*
* @param $content
* @param $conf
*/
function getCloudCarousel($content, $conf)
{
require_once t3lib_extMgm::extPath('imagecarousel') . 'pi2/class.tx_imagecarousel_pi2.php';
$obj = t3lib_div::makeInstance('tx_imagecarousel_pi2');
if ($conf['contentKey']) {
$obj->setContentKey($conf['contentKey']);
} else {
$obj->setContentKey($obj->extKey . '_' . $this->cObj->data['uid']);
}
$obj->conf = t3lib_div::array_merge($GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_imagecarousel_pi2.'], $conf);
$obj->cObj = $this->cObj;
$obj->type = 'chgallery';
$return_string = $obj->parseTemplate('', true);
return $content;
}
示例12: addLocalizedPagesToCache
/**
* add localized page records to a cache/globalArray
* This is much faster than requesting the DB for each tt_content-record
*
* @param array $pageRow
* @return void
*/
public function addLocalizedPagesToCache($pageRow)
{
// create entry in cachedPageRecods for default language
$this->cachedPageRecords[0][$pageRow['uid']] = $pageRow;
// create entry in cachedPageRecods for additional languages, skip default language 0
foreach ($this->sysLanguages as $sysLang) {
if ($sysLang[1] > 0) {
if (TYPO3_VERSION_INTEGER >= 7000000) {
list($pageOverlay) = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('pages_language_overlay', 'pid', $pageRow['uid'], 'AND sys_language_uid=' . intval($sysLang[1]));
} else {
list($pageOverlay) = t3lib_BEfunc::getRecordsByField('pages_language_overlay', 'pid', $pageRow['uid'], 'AND sys_language_uid=' . intval($sysLang[1]));
}
if ($pageOverlay) {
if (TYPO3_VERSION_INTEGER >= 7000000) {
$this->cachedPageRecords[$sysLang[1]][$pageRow['uid']] = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge($pageRow, $pageOverlay);
} else {
$this->cachedPageRecords[$sysLang[1]][$pageRow['uid']] = t3lib_div::array_merge($pageRow, $pageOverlay);
}
}
}
}
}
示例13: menuConfig
/**
* Adds items to the ->MOD_MENU array. Used for the function menu selector.
*
* @return void
*/
function menuConfig()
{
// Load the list of values that can be used as filters (filters are used only when all entries are being displayed)
$this->getLogFilters();
$this->MOD_MENU = array('function' => array('showlog' => $GLOBALS['LANG']->getLL('showlog'), 'cleanup' => $GLOBALS['LANG']->getLL('cleanup')), 'logrun' => array('1000' => $GLOBALS['LANG']->getLL('latest_run'), '25' => $GLOBALS['LANG']->getLL('latest_25'), '50' => $GLOBALS['LANG']->getLL('latest_50'), '100' => $GLOBALS['LANG']->getLL('latest_100'), '-1' => $GLOBALS['LANG']->getLL('all_entries')), 'autorefresh' => 0, 'page' => 0, 'expandAllExtraData' => 0, 'sword' => '');
$this->MOD_MENU['logrun'] = t3lib_div::array_merge($this->recentRuns, $this->MOD_MENU['logrun']);
// If the clear button has been clicked, empty all filters
if (!empty($this->setVars['clear'])) {
$this->selectedFilters = array();
$GLOBALS['BE_USER']->pushModuleData('selectedFilters', $this->selectedFilters);
} else {
if (isset($this->setVars['filters'])) {
$storedData = $GLOBALS['BE_USER']->getModuleData('selectedFilters');
if (isset($storedData)) {
$this->selectedFilters = array_merge($storedData, $this->setVars['filters']);
} else {
$this->selectedFilters = $this->setVars['filters'];
}
$GLOBALS['BE_USER']->pushModuleData('selectedFilters', $this->selectedFilters);
} else {
$this->selectedFilters = $GLOBALS['BE_USER']->getModuleData('selectedFilters');
}
}
parent::menuConfig();
}
示例14: getFileMetaInfo
/**
* get meta information from a file using the metaExtract service
*
* @param string file with absolut path
* @param array file meta information which should be extended
* @return array file meta information
* @todo what about using services in a chain?
*/
function getFileMetaInfo($pathname, $meta)
{
global $TYPO3_CONF_VARS;
$TX_DAM = $GLOBALS['T3_VAR']['ext']['dam'];
$conf = array();
$conf['wantedCharset'] = $this->getWantedCharset();
if (is_file($pathname) && is_readable($pathname)) {
$fileType = $meta['fields']['file_type'];
if ($this->setup['useInternalMediaTypeList']) {
// get media type from file type
$meta['fields']['media_type'] = $TX_DAM['file2mediaCode'][$fileType];
// or from mime type
$meta['fields']['media_type'] = $meta['fields']['media_type'] ? $meta['fields']['media_type'] : tx_dam::convert_mediaType($meta['fields']['file_mime_type']);
} else {
$meta['fields']['media_type'] = tx_dam::convert_mediaType($meta['fields']['file_mime_type']);
}
$mediaType = tx_dam::convert_mediaType($meta['fields']['media_type']);
// find a service for that file type
if (!is_object($serviceObj = t3lib_div::makeInstanceService('metaExtract', $fileType))) {
// find a global service for that media type
$serviceObj = t3lib_div::makeInstanceService('metaExtract', $mediaType . ':*');
}
if (is_object($serviceObj)) {
$serviceObj->setInputFile($pathname, $fileType);
$conf['meta'] = $meta;
if ($serviceObj->process('', '', $conf) > 0 and is_array($svmeta = $serviceObj->getOutput())) {
$meta = t3lib_div::array_merge_recursive_overrule($meta, $svmeta);
}
$serviceObj->__destruct();
unset($serviceObj);
}
// make simple image size detection if not yet done
if ($meta['fields']['media_type'] == TXDAM_mtype_image and intval($meta['fields']['hpixels']) == 0) {
$imgsize = $this->getImageDimensions($pathname, $meta);
$meta = t3lib_div::array_merge_recursive_overrule($meta, $imgsize);
}
$metaExtractServices = array();
$extraServiceTypes = array();
if (!isset($meta['fields']['meta']['EXIF']) and !$meta['exif_done']) {
$metaExtractServices[TXDAM_mtype_image][] = 'image:exif';
}
if (!isset($meta['fields']['meta']['IPTC']) and !$meta['iptc_done'] and (!isset($meta['fields']['meta']['XMP']) and !$meta['xmp_done'])) {
$metaExtractServices[TXDAM_mtype_image][] = 'image:iptc';
}
if ($extraServiceTypes) {
$metaExtractServices[TXDAM_mtype_image] = t3lib_div::array_merge($metaExtractServices[TXDAM_mtype_image], implode(', ', $extraServiceTypes));
}
// TODO should be possible to register other services too?!
// read exif, iptc data
if (is_array($metaExtractServices[$meta['fields']['media_type']])) {
foreach ($metaExtractServices[$meta['fields']['media_type']] as $subType) {
if ($serviceObj = t3lib_div::makeInstanceService('metaExtract', $subType)) {
$serviceObj->setInputFile($pathname, $fileType);
$conf['meta'] = $meta;
if ($serviceObj->process('', '', $conf) > 0 and is_array($svmeta = $serviceObj->getOutput())) {
$meta = t3lib_div::array_merge_recursive_overrule($meta, $svmeta);
}
$serviceObj->__destruct();
unset($serviceObj);
}
}
}
// convert extra meta data to xml
if (is_array($meta['fields']['meta'])) {
// content in array is expected as utf-8 because of xml functions
$meta['fields']['meta'] = $this->array2xml($meta['fields']['meta']);
}
// If no title then the file-name is set as title. This will raise the hits considerably if the search matches the document name.
if ($meta['fields']['title'] == '') {
$meta['fields']['title'] = $this->makeTitleFromFilename($meta['fields']['file_name']);
}
$meta['fields']['keywords'] = $this->listBeautify($meta['fields']['keywords']);
}
if ($this->writeDevLog) {
t3lib_div::devLog('getFileMetaInfo()', 'tx_dam_indexing', 0, $meta);
}
return $meta;
}