本文整理汇总了PHP中TYPO3\CMS\Core\Utility\GeneralUtility::makeInstanceService方法的典型用法代码示例。如果您正苦于以下问题:PHP GeneralUtility::makeInstanceService方法的具体用法?PHP GeneralUtility::makeInstanceService怎么用?PHP GeneralUtility::makeInstanceService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\GeneralUtility
的用法示例。
在下文中一共展示了GeneralUtility::makeInstanceService方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseResource
/**
*
*/
public function parseResource()
{
$configuration = $this->getConfiguration();
if (!ExtensionManagementUtility::isLoaded('phpexcel_library')) {
throw new \Exception('phpexcel_library is not loaded', 12367812368);
}
$filename = GeneralUtility::getFileAbsFileName($this->filepath);
GeneralUtility::makeInstanceService('phpexcel');
$objReader = \PHPExcel_IOFactory::createReaderForFile($filename);
$objReader->setReadDataOnly(true);
$objPHPExcel = $objReader->load($filename);
if ($configuration['sheet'] >= 0) {
$objWorksheet = $objPHPExcel->getSheet($configuration['sheet']);
} else {
$objWorksheet = $objPHPExcel->getActiveSheet();
}
$highestRow = $objWorksheet->getHighestRow();
$highestColumn = $objWorksheet->getHighestColumn();
$highestColumnIndex = \PHPExcel_Cell::columnIndexFromString($highestColumn);
for ($row = 1 + $configuration['skipRows']; $row <= $highestRow; ++$row) {
$rowRecord = [];
for ($col = 0; $col <= $highestColumnIndex; ++$col) {
$rowRecord[] = trim($objWorksheet->getCellByColumnAndRow($col, $row)->getValue());
}
$this->content[] = $rowRecord;
}
}
示例2: tx_cal_api_with
/**
* Example:
* require_once ('class.tx_cal_api.php');
* $calAPI = new Api($this->cObj, &$conf);
* $event = $calAPI->findEvent('2','tx_cal_phpicalendar');
*/
function tx_cal_api_with(&$cObj, &$conf)
{
$this->cObj =& $cObj;
$this->conf =& $conf;
if (!$GLOBALS['TCA']) {
$GLOBALS['TSFE']->includeTCA();
}
$this->conf['useInternalCaching'] = 1;
$this->conf['cachingEngine'] = 'cachingFramework';
$this->conf['writeCachingInfoToDevlog'] = 0;
$GLOBALS['TSFE']->settingLocale();
$this->controller = GeneralUtility::makeInstance('TYPO3\\CMS\\Cal\\Controller\\Controller');
$this->controller->cObj =& $this->cObj;
$this->controller->conf =& $this->conf;
$this->controller->setWeekStartDay();
$this->controller->cleanPiVarParam($this->piVars);
$this->controller->clearPiVarParams();
$this->controller->getParamsFromSession();
$this->controller->initCaching();
$this->controller->initConfigs();
\TYPO3\CMS\Cal\Controller\Controller::initRegistry($this->controller);
$this->rightsObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'rightscontroller');
$this->rightsObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstanceService('cal_rights_model', 'rights');
$this->rightsObj->setDefaultSaveToPage();
$this->modelObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'modelcontroller');
$this->modelObj = new \TYPO3\CMS\Cal\Controller\ModelController();
$this->viewObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'viewcontroller');
$this->viewObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Cal\\Controller\\ViewController');
/*
* $this->rightsObj = &\TYPO3\CMS\Cal\Utility\Registry::Registry('basic','rightscontroller'); $this->modelObj = &\TYPO3\CMS\Cal\Utility\Registry::Registry('basic','modelcontroller'); $this->viewObj = &\TYPO3\CMS\Cal\Utility\Registry::Registry('basic','viewcontroller');
*/
return $this;
}
示例3: while
public static function &getEventService()
{
$key = 'tx_cal_phpicalendar';
$serviceChain = '';
/* Loop over all services providign the specified service type and subtype */
while (is_object($eventService = GeneralUtility::makeInstanceService('cal_event_model', 'event', $serviceChain))) {
$serviceChain .= ',' . $eventService->getServiceKey();
/* If the key of the current service matches what we're looking for, return the object */
if ($key == $eventService->getServiceKey()) {
return $eventService;
}
}
}
示例4: initializeAction
/**
* General initialization
*
* @see \TYPO3\CMS\Extbase\Mvc\Controller\ActionController::initializeAction()
*/
public function initializeAction()
{
// Instanciating the lucene index service
/* @var $indexerService \Tollwerk\TwLucenesearch\Service\Lucene */
try {
$this->_indexService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstanceService('index', 'lucene');
// Else: if no index exists ...
} catch (\Exception $e) {
$this->_indexException = $e;
}
$this->_pageUid = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id'));
$config = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
$indexer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tollwerk\\TwLucenesearch\\Utility\\Indexer');
$this->_pageConfig = $indexer::indexConfigTS($config['config.']);
}
示例5: remind
function remind(&$event, $eventMonitor)
{
$this->startMailer();
switch ($eventMonitor['tablenames']) {
case 'fe_users':
$feUserRec = BackendUtility::getRecord('fe_users', $eventMonitor['uid_foreign']);
$this->process($event, $feUserRec['email'], $eventMonitor['tablenames'] . '_' . $feUserRec['uid']);
break;
case 'fe_groups':
$subType = 'getGroupsFE';
$groups = array();
$serviceObj = null;
$serviceObj = GeneralUtility::makeInstanceService('auth', $subType);
if ($serviceObj == null) {
return;
}
$serviceObj->getSubGroups($eventMonitor['uid_foreign'], '', $groups);
$select = 'DISTINCT fe_users.email';
$table = 'fe_groups, fe_users';
$where = 'fe_groups.uid IN (' . implode(',', $groups) . ')
AND FIND_IN_SET(fe_groups.uid, fe_users.usergroup)
AND fe_users.email != \'\'
AND fe_groups.deleted = 0
AND fe_groups.hidden = 0
AND fe_users.disable = 0
AND fe_users.deleted = 0';
$result2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where);
while ($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result2)) {
$this->process($event, $row2['email'], $eventMonitor['tablenames'] . '_' . $row2['uid']);
}
$GLOBALS['TYPO3_DB']->sql_free_result($result2);
break;
case 'tx_cal_unknown_users':
$feUserRec = BackendUtility::getRecord('tx_cal_unknown_users', $eventMonitor['uid_foreign']);
$this->process($event, $feUserRec['email'], $eventMonitor['tablenames'] . '_' . $feUserRec['uid']);
break;
}
}
示例6: lookupWithCallback
/**
* Looks up the latitude and longitude of a specified address. Cache tables
* are searched first, followed by external service lookups.
*
* @param string The street address.
* @param string The city name.
* @param string The state name.
* @param string This ZIP code.
* @param string The country name.
* @param string The optional API key to use in the lookup.
* @param boolean Force a new lookup for address.
* @return array Lat/long array for specified address. Null if lookup fails.
*/
static function lookupWithCallback($street, $city, $state, $zip, $country, $key = '', $forceLookup = false, &$pObj)
{
/* Do some basic normalization on the address */
self::normalizeAddress($street, $city, $state, $zip, $country);
/* If we have enough address information, try to geocode. If not, return null. */
if (self::isEmptyAddress($street, $city, $state, $zip, $country)) {
$latlong = null;
} else {
/* Look up the address in the cache table. */
$latlong = self::find($street, $city, $state, $zip, $country);
/* Didn't find a cached match */
if (is_null($latlong)) {
/* Intiate service chain to find lat/long */
$serviceChain = '';
while (is_object($lookupObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstanceService('geocode', '', $serviceChain))) {
$serviceChain .= ',' . $lookupObj->getServiceKey();
$latlong = $lookupObj->lookup($street, $city, $state, $zip, $country, $key);
if (method_exists($pObj, 'callback_lookupThroughGeocodeService')) {
$pObj->callback_lookupThroughGeocodeService();
}
/* If we found a match, quit. Otherwise proceed to next best service */
if ($latlong) {
break;
}
}
/* Insert the lat/long into the cache. */
self::insert($street, $city, $state, $zip, $country, $latlong['lat'], $latlong['long']);
$latlong['lat'] = trim($latlong['lat'], '0');
$latlong['long'] = trim($latlong['long'], '0');
}
/* Return the lat/long, either from cache table for from fresh lookup */
if ($latlong['lat'] == 0 and $latlong['long'] == 0) {
$latlong = null;
}
}
return $latlong;
}
示例7: detectsSwedishLanguage
/**
* @test
*/
public function detectsSwedishLanguage()
{
$service = GeneralUtility::makeInstanceService('textLang');
$service->setInputFile($this->testDocumentsPath . 'sv.test', 'txt');
$service->process();
$language = $service->getOutput();
$this->assertEquals('sv', $language);
}
示例8: array
//.........这里部分代码省略.........
if ($formatedGetdate == $today->format('%Y%m%d')) {
$style[] = $this->conf['view.']['month.']['monthTodayStyle'];
}
if ($this->conf['view.']['month.']['monthDayOfWeekStyle']) {
$style[] = sprintf($this->conf['view.']['month.']['monthDayOfWeekStyle'], $start_day->format('%w'));
}
//clean up empty styles (code beautify)
foreach ($style as $key => $classname) {
if ($classname == '') {
unset($style[$key]);
}
}
// Adds hook for processing of extra month day style markers
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['tx_cal_controller']['extraMonthDayStyleMarkerHook'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['tx_cal_controller']['extraMonthDayStyleMarkerHook'] as $_classRef) {
$_procObj =& GeneralUtility::getUserObj($_classRef);
if (is_object($_procObj) && method_exists($_procObj, 'extraMonthDayStyleMarkerProcessor')) {
$_procObj->extraMonthDayStyleMarkerProcessor($this, $daylink, $switch, $type, $style);
}
}
}
$classesDay = implode(' ', $style);
$markerArray = array('###STYLE###' => $classesDay, '###ADDITIONAL_CLASSES###' => $classesDay ? ' ' . $classesDay : '', '###CLASSES###' => $classesDay ? ' class="' . $classesDay . '" ' : '', '###DAY_ID###' => $formatedGetdate);
$temp = strtr($t_month, $markerArray);
$wraped = array();
if ($this->viewarray[$formatedGetdate] && preg_match('!\\###EVENT\\###!is', $t_month)) {
foreach ($this->viewarray[$formatedGetdate] as $cal_time => $event_times) {
foreach ($event_times as $uid => $eventId) {
if ($type == 'large') {
$switch['###EVENT###'] .= $this->eventArray[$eventId]->renderEventForMonth();
} else {
if ($type == 'medium') {
$switch['###EVENT###'] .= $this->eventArray[$eventId]->renderEventForYear();
} else {
if ($type == 'small') {
$switch['###EVENT###'] .= $this->eventArray[$eventId]->renderEventForMiniMonth();
}
}
}
}
}
}
if (!isset($switch['###EVENT###'])) {
$this->initLocalCObject();
$switch['###EVENT###'] = $this->local_cObj->cObjGetSingle($this->conf['view.'][$viewTarget . '.']['event.']['noEventFound'], $this->conf['view.'][$viewTarget . '.']['event.']['noEventFound.']);
}
if (!isset($switch['###ALLDAY###'])) {
$this->initLocalCObject();
$switch['###ALLDAY###'] = $this->local_cObj->cObjGetSingle($this->conf['view.'][$viewTarget . '.']['event.']['noEventFound'], $this->conf['view.'][$viewTarget . '.']['event.']['noEventFound.']);
}
// Adds hook for processing of extra month day markers
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['tx_cal_controller']['extraMonthDayMarkerHook'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['tx_cal_controller']['extraMonthDayMarkerHook'] as $_classRef) {
$_procObj =& GeneralUtility::getUserObj($_classRef);
if (is_object($_procObj) && method_exists($_procObj, 'extraMonthDayMarkerProcessor')) {
$switch = $_procObj->extraMonthDayMarkerProcessor($this, $daylink, $switch, $type);
}
}
}
$middle .= \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($temp, $switch, array(), $wraped);
$start_day->addSeconds(86400);
// 60 * 60 *24 -> strtotime('+1 day', $start_day);
if ($i == 7) {
$i = 0;
$middle .= $endweek;
$checkagain = $start_day->getMonth();
if ($checkagain != $minical_month) {
$whole_month = FALSE;
}
}
} while ($whole_month == TRUE);
$rems['###LOOPWEEKDAY###'] = $weekday_loop;
$rems['###LOOPMONTHWEEKS###'] = $middle;
$rems['###LOOPMONTHWEEKS_DAYS###'] = '';
$rems['###LOOPWEEK_NUMS###'] = '';
$rems['###CORNER###'] = '';
$monthTemplate = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($monthTemplate, array(), $rems, array());
$monthTemplate .= $ajaxEvents;
$page = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, array(), array('###MONTH_TEMPLATE###' => $monthTemplate), array());
}
$listTemplate = $this->cObj->getSubpart($page, '###LIST###');
if ($listTemplate != '') {
$tx_cal_listview =& GeneralUtility::makeInstanceService('cal_view', 'list', 'list');
$starttime = gmmktime(0, 0, 0, $this_month, 1, $this_year);
$endtime = gmmktime(0, 0, 0, $this_month + 1, 1, $this_year);
$rems['###LIST###'] = $tx_cal_listview->drawList($this->master_array, $listTemplate, $starttime, $endtime);
}
$return = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, array(), $rems, array());
if ($this->rightsObj->isViewEnabled($viewTarget) || $this->conf['view.'][$viewTarget . '.'][$viewTarget . 'ViewPid']) {
$this->initLocalCObject();
$this->local_cObj->setCurrentVal($month_title);
$this->local_cObj->data['view'] = $viewTarget;
$this->controller->getParametersForTyposcriptLink($this->local_cObj->data, array('getdate' => $month_date, 'view' => $viewTarget, $this->pointerName => NULL), $this->conf['cache'], $this->conf['clear_anyway'], $this->conf['view.'][$viewTarget . '.'][$viewTarget . 'ViewPid']);
$month_link = $this->local_cObj->cObjGetSingle($this->conf['view.'][$viewTarget . '.'][$viewTarget . 'ViewLink'], $this->conf['view.'][$viewTarget . '.'][$viewTarget . 'ViewLink.']);
} else {
$month_link = $month_title;
}
$return = str_replace('###MONTH_LINK###', $month_link, $return);
return $return;
}
示例9: notify
function notify(&$newEventDataArray, $forceDeletionMode = 0)
{
$event = $this->modelObj->findEvent($newEventDataArray['uid'], 'tx_cal_phpicalendar', $this->conf['pidList'], true, true, false, true, true);
if (is_object($event)) {
$this->startMailer();
$select = 'fe_users.*';
$table = 'fe_users, tx_cal_fe_user_event_monitor_mm, tx_cal_event';
$where = 'fe_users.uid = tx_cal_fe_user_event_monitor_mm.uid_foreign AND tx_cal_fe_user_event_monitor_mm.uid_local = tx_cal_event.uid AND tx_cal_event.deleted = ' . intval($newEventDataArray['deleted']) . ' AND tx_cal_event.uid = ' . $newEventDataArray['uid'];
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where);
while ($row1 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
if ($row1['email'] != '' && GeneralUtility::validEmail($row1['email'])) {
if ($newEventDataArray['deleted'] + $forceDeletionMode > 0) {
$template = $this->conf['view.']['event.']['notify.']['fe_users_' . $row1['uid'] . '.']['onDeleteTemplate'];
if (!$template) {
$template = $this->conf['view.']['event.']['notify.']['all.']['onDeleteTemplate'];
}
$titleText = $this->conf['view.']['event.']['notify.']['fe_users_' . $row1['uid'] . '.']['onDeleteEmailTitle'];
if (!$titleText) {
$titleText = $this->conf['view.']['event.']['notify.']['all.']['onDeleteEmailTitle'];
}
} else {
$template = $this->conf['view.']['event.']['notify.']['fe_users_' . $row1['uid'] . '.']['onCreateTemplate'];
if (!$template) {
$template = $this->conf['view.']['event.']['notify.']['all.']['onCreateTemplate'];
}
$titleText = $this->conf['view.']['event.']['notify.']['fe_users_' . $row1['uid'] . '.']['onCreateEmailTitle'];
if (!$titleText) {
$titleText = $this->conf['view.']['event.']['notify.']['all.']['onCreateEmailTitle'];
}
}
$unsubscribeLink = $this->baseUrl . $this->controller->pi_getPageLink($this->conf['view.']['event.']['notify.']['subscriptionViewPid'], '', array('tx_cal_controller[view]' => 'subscription', 'tx_cal_controller[email]' => $row1['email'], 'tx_cal_controller[uid]' => $event->getUid(), 'tx_cal_controller[monitor]' => 'stop', 'tx_cal_controller[sid]' => md5($event->getUid() . $row1['email'] . $row1['crdate'])));
$this->sendNotification($event, $row1['email'], $template, $titleText, $unsubscribeLink);
}
}
$GLOBALS['TYPO3_DB']->sql_free_result($result);
$select = 'tx_cal_unknown_users.*';
$table = 'tx_cal_unknown_users, tx_cal_fe_user_event_monitor_mm, tx_cal_event';
$where = 'tx_cal_unknown_users.uid = tx_cal_fe_user_event_monitor_mm.uid_foreign AND tx_cal_fe_user_event_monitor_mm.uid_local = tx_cal_event.uid AND tx_cal_event.uid = ' . $event->getUid();
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where);
while ($row1 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
if ($row1['email'] != '' && GeneralUtility::validEmail($row1['email'])) {
$template = $this->conf['view.']['event.']['notify.']['all.']['onCreateTemplate'];
$titleText = $this->conf['view.']['event.']['notify.']['all.']['onCreateEmailTitle'];
if ($newEventDataArray['deleted'] + $forceDeletionMode > 0) {
$template = $this->conf['view.']['event.']['notify.']['all.']['onDeleteTemplate'];
$titleText = $this->conf['view.']['event.']['notify.']['all.']['onDeleteEmailTitle'];
}
$unsubscribeLink = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $this->controller->pi_getPageLink($this->conf['view.']['event.']['notify.']['subscriptionViewPid'], '', array('tx_cal_controller[view]' => 'subscription', 'tx_cal_controller[email]' => $row1['email'], 'tx_cal_controller[uid]' => $event->getUid(), 'tx_cal_controller[monitor]' => 'stop', 'tx_cal_controller[sid]' => md5($event->getUid() . $row1['email'] . $row1['crdate'])));
$this->sendNotification($event, $row1['email'], $template, $titleText, $unsubscribeLink);
}
}
$GLOBALS['TYPO3_DB']->sql_free_result($result);
foreach ($event->getCategories() as $category) {
foreach ($category->getNotificationEmails() as $emailAddress) {
if ($emailAddress != '' && GeneralUtility::validEmail($emailAddress)) {
if ($newEventDataArray['deleted'] + $forceDeletionMode > 0) {
$template = $this->conf['view.']['event.']['notify.'][$category->getUid() . '.']['onDeleteTemplate'];
if (!$template) {
$template = $this->conf['view.']['event.']['notify.']['all.']['onDeleteTemplate'];
}
$titleText = $this->conf['view.']['event.']['notify.'][$category->getUid() . '.']['onDeleteEmailTitle'];
if (!$titleText) {
$titleText = $this->conf['view.']['event.']['notify.']['all.']['onDeleteEmailTitle'];
}
} else {
$template = $this->conf['view.']['event.']['notify.'][$category->getUid() . '.']['onCreateTemplate'];
if (!$template) {
$template = $this->conf['view.']['event.']['notify.']['all.']['onCreateTemplate'];
}
$titleText = $this->conf['view.']['event.']['notify.'][$category->getUid() . '.']['onCreateEmailTitle'];
if (!$titleText) {
$titleText = $this->conf['view.']['event.']['notify.']['all.']['onCreateEmailTitle'];
}
}
$unsubscribeLink = '';
$this->sendNotification($event, $emailAddress, $template, $titleText, $unsubscribeLink);
}
}
}
$subType = 'getGroupsFE';
$groups = array();
$serviceObj = null;
$serviceObj = GeneralUtility::makeInstanceService('auth', $subType);
if ($serviceObj == null) {
return;
}
$select = 'tx_cal_fe_user_event_monitor_mm.uid_local';
$table = 'tx_cal_fe_user_event_monitor_mm';
$where = 'tx_cal_fe_user_event_monitor_mm.uid_foreign = ' . $event->getUid() . ' AND tx_cal_fe_user_event_monitor_mm.tablenames = "fe_groups"';
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where);
while ($row1 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
$serviceObj->getSubGroups($row1['uid_local'], '', $groups);
$select = 'DISTINCT fe_users.email';
$table = 'fe_groups, fe_users';
$where = 'fe_groups.uid IN (' . implode(',', $groups) . ')
AND FIND_IN_SET(fe_groups.uid, fe_users.usergroup)
AND fe_users.email != \'\'
AND fe_groups.deleted = 0
AND fe_groups.hidden = 0
AND fe_users.disable = 0
//.........这里部分代码省略.........
示例10: autocompleteAction
/**
* Autocomplete feature
*
* @param \string $searchterm Search terms
* @return \string JSON encoded autocomplete suggestions
*/
public function autocompleteAction($searchterm = '')
{
$this->response->setHeader('Content-Type', 'application/json; charset=utf-8');
$this->response->sendHeaders();
// Instanciating the lucene index service
/* @var $indexerService \Tollwerk\TwLucenesearch\Service\Lucene */
$indexerService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstanceService('index', 'lucene');
$suggestions = $indexerService instanceof \TYPO3\CMS\Core\Service\AbstractService ? $indexerService->autocomplete($searchterm) : array();
return json_encode($suggestions);
}
示例11: findAllObjects
function findAllObjects($key, $type, $pidList, $functionTobeCalled = '', $paramsToBePassedOn = '')
{
/* No key provided so return all X */
$serviceName = 'cal_' . $key . '_model';
$objects = array();
if ($type == '') {
$serviceChain = '';
/* Iterate over all classes providing the cal_X_model service */
while (is_object($service =& GeneralUtility::makeInstanceService($serviceName, $key, $serviceChain))) {
if ($functionTobeCalled) {
if (method_exists($service, $functionTobeCalled)) {
$objects[$service->getServiceKey()] = $service->{$functionTobeCalled}($paramsToBePassedOn);
}
} else {
$objects[$service->getServiceKey()] = $service->findAll($pidList);
}
$serviceChain .= ',' . $service->getServiceKey();
}
} else {
/* Gets the model for the provided service key */
$service =& $this->getServiceObjByKey($serviceName, $key, $type);
/* Look up a objects with a specific ID inside the model */
if ($functionTobeCalled) {
if (method_exists($service, $functionTobeCalled)) {
$objects[$type] = $service->{$functionTobeCalled}($paramsToBePassedOn);
}
} else {
$objects[$type] = $service->findAll($pidList);
}
}
return $objects;
}
示例12: getServiceObjByKey
/**
* Helper function to return a service object with the given type, subtype, and serviceKey
*
* @param
* string The type of the service.
* @param
* string The subtype of the service.
* @param
* string The serviceKey.
* @return object service object.
*/
function getServiceObjByKey($type, $subtype = '', $key)
{
$serviceChain = '';
/* Loop over all services providign the specified service type and subtype */
while (is_object($obj =& \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstanceService($type, $subtype, $serviceChain))) {
$serviceChain .= ',' . $obj->getServiceKey();
return $obj;
}
return;
}
示例13: getTemplateSubpartMarker
protected function getTemplateSubpartMarker(&$template, &$sims, &$rems, &$wrapped)
{
preg_match_all('!\\<\\!--[a-zA-Z0-9 ]*###([A-Z0-9_-|]*)\\###[a-zA-Z0-9 ]*-->!is', $template, $match);
$allMarkers = array_unique($match[1]);
foreach ($allMarkers as $marker) {
switch ($marker) {
case 'FORM_START':
$this->getFormStartMarker($template, $sims, $rems, $wrapped);
break;
case 'FORM_END':
$this->getFormEndMarker($template, $sims, $rems, $wrapped);
break;
default:
if (preg_match('/MODULE__([A-Z0-9_-])*/', $marker)) {
$module = GeneralUtility::makeInstanceService(substr($marker, 8), 'module');
if (is_object($module)) {
$rems['###' . $marker . '###'] = $module->start($this);
}
}
break;
}
}
}
示例14: switch
//.........这里部分代码省略.........
}
}
}
if ($table == 'tx_cal_category' && array_key_exists('calendar_id', $incomingFieldArray) && !strstr($id, 'NEW')) {
$category = BackendUtility::getRecord('tx_cal_category', $id);
if ($incomingFieldArray['calendar_id'] != $category['calendar_id']) {
$incomingFieldArray['parent_category'] = 0;
}
}
/* If an existing calendar is updated */
if ($table == 'tx_cal_calendar' && array_key_exists('type', $incomingFieldArray) && !strstr($id, 'NEW')) {
/* Get the calendar info from the db */
$calendar = BackendUtility::getRecord('tx_cal_calendar', $id);
$service = new \TYPO3\CMS\Cal\Service\ICalendarService();
// Here we have to check if the calendar belongs to the type
// problem with case 2 & 3 -> what to do with events of type database? delete them without warning? keep them and assign them to a default category?
switch ($incomingFieldArray['type']) {
case 0:
/* Standard */
/* Delete any temporary events previously associated with this calendar */
if ($calendar['type'] != 0) {
$service->deleteTemporaryEvents($id);
$service->deleteSchedulerTask($id);
$calendar['schedulerId'] = 0;
/** @var \TYPO3\CMS\Cal\Utility\RecurrenceGenerator $rgc */
$rgc = GeneralUtility::makeInstance('TYPO3\\CMS\\Cal\\Utility\\RecurrenceGenerator');
$rgc->cleanIndexTableOfCalendarUid($id);
}
break;
case 1:
/* External URL or ICS file */
/* External URL or ICS file */
case 2:
/* ICS File */
$this->processICS($calendar, $incomingFieldArray, $service);
break;
}
}
if ($table == 'tx_cal_exception_event_group' && !strstr($id, 'NEW')) {
$exceptionEvent = BackendUtility::getRecord('tx_cal_exception_event_group', $id);
/* If we're in a workspace, don't notify anyone about the event */
if ($exceptionEvent['pid'] > 0 && !$GLOBALS['BE_USER']->workspace) {
/* Check Page TSConfig for a preview page that we should use */
$pageTSConf = BackendUtility::getPagesTSconfig($exceptionEvent['pid']);
if ($pageTSConf['options.']['tx_cal_controller.']['pageIDForPlugin']) {
$pageIDForPlugin = $pageTSConf['options.']['tx_cal_controller.']['pageIDForPlugin'];
} else {
$pageIDForPlugin = $exceptionEvent['pid'];
}
$page = BackendUtility::getRecord('pages', intval($pageIDForPlugin), "doktype");
if ($page['doktype'] != 254) {
$tx_cal_api = GeneralUtility::makeInstance('TYPO3\\CMS\\Cal\\Controller\\Api');
$tx_cal_api = $tx_cal_api->tx_cal_api_without($pageIDForPlugin);
/** @var \TYPO3\CMS\Cal\Utility\RecurrenceGenerator $rgc */
$rgc = GeneralUtility::makeInstance('TYPO3\\CMS\\Cal\\Utility\\RecurrenceGenerator');
$rgc->cleanIndexTableOfExceptionGroupUid($id);
}
}
}
if ($table == 'tx_cal_attendee') {
$incomingFieldArray['fe_user_id'] = str_replace(array(',', 'fe_users_'), array('', ''), $incomingFieldArray['fe_user_id']);
$incomingFieldArray['fe_group_id'] = str_replace(array(',', 'fe_groups_'), array('', ''), $incomingFieldArray['fe_group_id']);
if ($incomingFieldArray['fe_group_id'] > 0) {
$subType = 'getGroupsFE';
$groups = array(0);
$serviceObj = null;
$serviceObj = GeneralUtility::makeInstanceService('auth', $subType);
if ($serviceObj == null) {
return;
}
$serviceObj->getSubGroups($incomingFieldArray['fe_group_id'], '', $groups);
unset($incomingFieldArray['fe_group_id']);
$select = 'DISTINCT fe_users.*';
$table = 'fe_groups, fe_users';
$where = 'fe_groups.uid IN (' . implode(',', $groups) . ')
AND FIND_IN_SET(fe_groups.uid, fe_users.usergroup)
AND fe_users.email != \'\'
AND fe_groups.deleted = 0
AND fe_groups.hidden = 0
AND fe_users.disable = 0
AND fe_users.deleted = 0';
$result2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where);
$attendeeUids = array();
while ($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result2)) {
$incomingFieldArray['fe_user_id'] = $row2['fe_users.uid'];
$result = $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_cal_attendee', $incomingFieldArray);
if (FALSE === $result) {
throw new \RuntimeException('Could not write attendee record to database: ' . $GLOBALS['TYPO3_DB']->sql_error(), 1431458136);
}
$attendeeUids[] = $GLOBALS['TYPO3_DB']->sql_insert_id();
}
$GLOBALS['TYPO3_DB']->sql_free_result($result2);
// $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_cal_event', $incomingFieldArray);
foreach ($tce->datamap['tx_cal_event'] as $eventUid => $eventArray) {
$eventArray['attendee'] = array_unique(array_merge(GeneralUtility::trimExplode(',', $eventArray['attendee'], 1), $attendeeUids));
}
}
unset($incomingFieldArray['fe_group_id']);
}
}
示例15: extractsTextFromTxtFile
/**
* @test
*/
public function extractsTextFromTxtFile()
{
$service = GeneralUtility::makeInstanceService('textExtract', 'txt');
$service->setInputFile($this->testDocumentsPath . 'testTXT.txt', 'txt');
$service->process();
$expectedText = 'Test';
$extractedText = $service->getOutput();
$this->assertContains($expectedText, $extractedText);
}