作者:r3h
项目:TYPO3.EXT.jobqueue_beanstalk
/**
* Set up dependencies
*/
public function setUp()
{
parent::setUp();
$this->objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$this->queue = $this->objectManager->get(BeanstalkdQueue::class, self::QUEUE_NAME, []);
/** @var Pheanstalk\Pheanstalk $client */
$client = $this->queue->getClient();
// flush queue:
try {
while (true) {
$job = $client->peekDelayed(self::QUEUE_NAME);
$client->delete($job);
}
} catch (\Exception $e) {
}
try {
while (true) {
$job = $client->peekBuried(self::QUEUE_NAME);
$client->delete($job);
}
} catch (\Exception $e) {
}
try {
while (true) {
$job = $client->peekReady(self::QUEUE_NAME);
$client->delete($job);
}
} catch (\Exception $e) {
}
}
作者:frans-beech-i
项目:linkhandle
/**
* Sets up this test suite.
*/
public function setUp()
{
parent::setUp();
$this->setUpBackendUserFromFixture(1);
$this->importDataSet(ORIGINAL_ROOT . 'typo3conf/ext/linkhandler/Tests/Functional/Fixtures/base_structure.xml');
$this->importDataSet(ORIGINAL_ROOT . 'typo3conf/ext/linkhandler/Tests/Functional/Fixtures/tx_news_domain_model_news.xml');
/** @var \TYPO3\CMS\Lang\LanguageService $languageService */
$languageService = $this->getMock('TYPO3\\CMS\\Lang\\LanguageService');
$GLOBALS['LANG'] = $languageService;
/** @var \TYPO3\CMS\Core\TimeTracker\TimeTracker $timeTracker */
$timeTracker = $this->getMock('TYPO3\\CMS\\Core\\TimeTracker\\TimeTracker');
$GLOBALS['TT'] = $timeTracker;
/** @var \TYPO3\CMS\Frontend\Page\PageRepository $pageRepository */
$pageRepository = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
/** @var \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $typoScriptFrontendController */
$typoScriptFrontendController = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], 1, 0);
$this->typoScriptFrontendController = $typoScriptFrontendController;
$GLOBALS['TSFE'] = $typoScriptFrontendController;
$typoScriptFrontendController->sys_page = $pageRepository;
$typoScriptFrontendController->getPageAndRootline();
$typoScriptFrontendController->initTemplate();
$typoScriptFrontendController->getConfigArray();
// This is needed for the configuration manager to load the correct TSconfig.
$_GET['P'] = array('pid' => 1);
/** @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObjectRenderer */
$contentObjectRenderer = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
$contentObjectRenderer->start(array());
$this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
/** @var \TYPO3\CMS\Extbase\Configuration\ConfigurationManager $configurationManager */
$configurationManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');
$configurationManager->setContentObject($contentObjectRenderer);
$this->uriBuilder = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder');
}
作者:qbus-agentu
项目:nc_staticfilecach
/**
* Get the static file cache
*
* @return FrontendInterface
* @throws NoSuchCacheException
*/
public static function getCache()
{
/** @var CacheManager $cacheManager */
$objectManager = new ObjectManager();
$cacheManager = $objectManager->get(CacheManager::class);
return $cacheManager->getCache('static_file_cache');
}
作者:heiko-hard
项目:behat-typo3-extensio
/**
* TYPO3 boot
*
* @param \Behat\Behat\Context\Context $context
* @param \Behat\Behat\Hook\Scope\ScenarioScope $scope
*/
public function TYPO3Boot(&$context = NULL, &$scope = NULL)
{
if (!defined('ORIGINAL_ROOT')) {
define('ORIGINAL_ROOT', strtr(getenv('TYPO3_PATH_WEB') ? getenv('TYPO3_PATH_WEB') . '/' : getcwd() . '/', '\\', '/'));
}
if (getenv('BEHAT_TYPO3_DOCROOT') && !defined('BEHAT_ROOT')) {
define('BEHAT_ROOT', strtr(getenv('BEHAT_TYPO3_DOCROOT'), '\\', '/'));
}
$this->typo3BootstrapUtility = defined('BEHAT_ROOT') ? new Typo3BootstrapUtilityStatic() : new Typo3BootstrapUtilityDynamic();
$this->typo3InstancePath = $this->typo3BootstrapUtility->setUp($scope->getFeature()->getFile(), $this->typo3CoreExtensionsToLoad, $this->typo3TestExtensionsToLoad, $this->typo3PathsToLinkInTestInstance, $this->typo3ConfigurationToUseInTestInstance, $this->typo3AdditionalFoldersToCreate);
// import db
if (count($this->typo3DatabaseToImport) > 0) {
foreach ($this->typo3DatabaseToImport as $path) {
$this->importDataSet($path);
}
}
// setup fe
if (count($this->typo3FrontendRootPage) > 0) {
$this->setupFrontendRootPage($this->typo3FrontendRootPage['pageId'], $this->typo3FrontendRootPage['typoscript'], $this->typo3FrontendRootPage['typoscriptConstants']);
}
// rewrite mink parameter
$this->typo3BootstrapUtility->rewriteMinkParameter($context);
// preparing object manager
$this->typo3ObjectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
// preparing persistance manager
$this->typo3PersistenceManager = $this->typo3ObjectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager');
}
作者:r3h
项目:TYPO3.EXT.jobqueue_databas
public function setUp()
{
parent::setUp();
$this->objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$this->queue = $this->objectManager->get(DatabaseQueue::class, self::QUEUE_NAME, ['timeout' => 0]);
$this->setUpBasicFrontendEnvironment();
}
作者:ercuemen
项目:in
/**
* Render the different elements and collect the single lines.
* After the rendering the lines will be imploded. Notice:
* All methods after this are CType rendering helper
*
* @param string $content
* @param array $conf
*
* @return array
*/
public function render($content, $conf)
{
$lines = array();
$this->conf = $conf;
$CType = (string) $this->cObj->data['CType'];
if (isset($this->conf['forceCType']) && trim($this->conf['forceCType']) !== '') {
$CType = trim($this->conf['forceCType']);
}
$renderer = array('html' => 'FRUIT\\Ink\\Rendering\\Html', 'header' => 'FRUIT\\Ink\\Rendering\\Header', 'table' => 'FRUIT\\Ink\\Rendering\\Table', 'menu' => 'FRUIT\\Ink\\Rendering\\Menu', 'text' => 'FRUIT\\Ink\\Rendering\\Text', 'image' => 'FRUIT\\Ink\\Rendering\\Image', 'textpic' => 'FRUIT\\Ink\\Rendering\\TextPicture', 'templavoila_pi1' => 'FRUIT\\Ink\\Rendering\\Templavoila', 'list' => 'FRUIT\\Ink\\Rendering\\Plugin');
GeneralUtility::requireOnce(ExtensionManagementUtility::extPath('ink', 'Classes/Rendering/Plugin.php'));
GeneralUtility::requireOnce(ExtensionManagementUtility::extPath('ink', 'Classes/Rendering/Image.php'));
GeneralUtility::requireOnce(ExtensionManagementUtility::extPath('ink', 'Classes/Rendering/Menu.php'));
$objectManager = new ObjectManager();
/** @var Dispatcher $signalSlot */
$signalSlot = $objectManager->get('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher');
$returnData = $signalSlot->dispatch(__CLASS__, 'renderer', array('renderer' => $renderer));
$renderer = $returnData['renderer'];
if (isset($renderer[$CType])) {
$className = $renderer[$CType];
/** @var RenderingInterface $renderObject */
$renderObject = $objectManager->get($className);
$lines = $renderObject->render($this->cObj, $this->conf);
} else {
$lines[] = 'CType: ' . $CType . ' have no rendering definitions';
}
$content = implode(LF, $lines);
return trim($content, CRLF . TAB);
}
作者:kschu9
项目:TYPO3-fileshar
/**
* initialize dependencies an build TSFE
*/
public function __construct()
{
$objectManager = new ObjectManager();
/** @var BackendUriBuilder $viewHelper */
$this->uriBuilder = $objectManager->get('I4W\\Fileshare\\Mvc\\Web\\Routing\\BackendUriBuilder');
$this->configuration = $objectManager->get('I4W\\Fileshare\\TYPO3\\Configuration\\ExtensionConfiguration');
$this->buildTSFE();
}
作者:t3d
项目:T3DD16.Backen
/**
* PlanningUtility constructor.
*/
public function __construct()
{
$this->objM = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
$this->sessionRepository = $this->objM->get(AnySessionRepository::class);
$this->db = $GLOBALS['TYPO3_DB'];
$dateTimeFormats = $this->db->getDateTimeFormats('tx_sessions_domain_model_session');
$this->dbDateTimeFormat = $dateTimeFormats['datetime']['format'];
}
作者:werner
项目:t3ext-dam_falmigratio
/**
* initializes this object
*/
protected function init()
{
$this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$this->database = $GLOBALS['TYPO3_DB'];
$this->fileRepository = $this->objectManager->get('TYPO3\\CMS\\Core\\Resource\\FileRepository');
$fileFactory = ResourceFactory::getInstance();
$this->storageObject = $fileFactory->getStorageObject($this->storageUid);
}
作者:bernhardberge
项目:google_service
/**
* Get a provider
*
* @param string $name
*
* @throws InvalidArgumentValueException
* @return SitemapProviderInterface
*/
public static function getProvider($name)
{
if (!isset(self::$provider[$name])) {
throw new InvalidArgumentValueException($name . ' not exists');
}
$obj = new ObjectManager();
return $obj->get($name);
}
作者:AOEpeopl
项目:scheduler_timelin
/**
* SetUp
*/
public function setUp()
{
parent::setUp();
$this->importDataSet(__DIR__ . '/Fixtures/tx_schedulertimeline_domain_model_log.xml');
$this->importDataSet(__DIR__ . '/Fixtures/tx_scheduler_task.xml');
$this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$this->logRepository = $this->objectManager->get('AOE\\SchedulerTimeline\\Domain\\Repository\\LogRepository');
}
作者:bernhardberge
项目:aoe_ipaut
/**
*
*/
public function setUp()
{
$this->testExtensionsToLoad = array('typo3conf/ext/aoe_ipauth');
parent::setUp();
/** @var $this->objectManager \TYPO3\CMS\Extbase\Object\ObjectManager */
$this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$this->fixture = $this->objectManager->get('AOE\\AoeIpauth\\Hooks\\Staticfilecache');
}
作者:r3h
项目:TYPO3.EXT.data_por
public function setUp()
{
parent::setUp();
$this->objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$this->subject = $this->objectManager->get(ImportService::class);
$this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Fixtures/pages.xml');
// $this->setUpBasicFrontendEnvironment();
}
作者:bernhardberge
项目:aoe_ipaut
/**
*
*/
public function setUp()
{
$this->testExtensionsToLoad = array('typo3conf/ext/aoe_ipauth');
parent::setUp();
$this->fixturePath = __DIR__ . '/Fixtures/';
/** @var $this->objectManager \TYPO3\CMS\Extbase\Object\ObjectManager */
$this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$this->fixture = $this->objectManager->get('AOE\\AoeIpauth\\Domain\\Service\\FeEntityService');
}
作者:electricretin
项目:cicbas
/**
* CONSTRUCTOR
*/
public function __construct()
{
$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$this->injectObjectManager($objectManager);
$commandManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Cli\\CommandManager');
$this->injectCommandManager($commandManager);
$reflectionService = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService');
$this->injectReflectionService($reflectionService);
}
作者:r3h
项目:TYPO3.EXT.frp_exampl
public function setUp()
{
parent::setUp();
$this->objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$this->itemRepository = $this->objectManager->get(ItemRepository::class);
$this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Fixtures/pages.xml');
$this->importDataSet(ORIGINAL_ROOT . 'typo3conf/ext/frp_example/Tests/Functional/Domain/Repository/Fixtures/sys_template.xml');
$this->importDataSet(ORIGINAL_ROOT . 'typo3conf/ext/frp_example/Tests/Functional/Domain/Repository/Fixtures/item.xml');
$this->setUpBasicFrontendEnvironment();
}
作者:AgenceStrati
项目:TYPO3-Site-Factor
/**
* Construction function.
*
* @param array $duplicationData
* @param array $duplicationSettings
* @param array $fieldsValues
*/
public function __construct(array $duplicationData = array(), array $duplicationSettings = array(), $fieldsValues = array())
{
$this->objectManager = Core::getObjectManager();
$this->database = Core::getDatabase();
$this->extensionConfiguration = Core::getExtensionConfiguration();
$this->result = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Error\\Result');
$this->setDuplicationData($duplicationData);
$this->setDuplicationSettings($duplicationSettings);
$this->initializeFields($fieldsValues);
}
作者:romaincano
项目:TYPO3-Site-Factor
/**
* Construction function.
*
* @param array $duplicationData
* @param array $duplicationSettings
* @param array $fieldsValues
*/
public function __construct(array $duplicationData = [], array $duplicationSettings = [], $fieldsValues = [])
{
$this->objectManager = Core::getObjectManager();
$this->database = Core::getDatabase();
$this->extensionConfiguration = Core::getExtensionConfiguration();
$this->result = $this->objectManager->get(Result::class);
$this->setDuplicationData($duplicationData);
$this->setDuplicationSettings($duplicationSettings);
$this->initializeFields($fieldsValues);
}
作者:derhanse
项目:sf_event_mg
/**
* Checks if the given value is a valid recaptcha.
*
* @param mixed $value The value that should be validated
* @throws InvalidVariableException
*/
public function isValid($value)
{
$response = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('g-recaptcha-response');
if ($response !== null) {
// Only check if a response is set
$configurationManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');
$fullTs = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
$reCaptchaSettings = $fullTs['plugin.']['tx_sfeventmgt.']['settings.']['reCaptcha.'];
if (isset($reCaptchaSettings) && is_array($reCaptchaSettings) && isset($reCaptchaSettings['secretKey']) && $reCaptchaSettings['secretKey']) {
$ch = curl_init();
$fields = ['secret' => $reCaptchaSettings['secretKey'], 'response' => $response];
// url-ify the data for the POST
$fieldsString = '';
foreach ($fields as $key => $value) {
$fieldsString .= $key . '=' . $value . '&';
}
rtrim($fieldsString, '&');
// set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, 'https://www.google.com/recaptcha/api/siteverify');
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fieldsString);
// execute post
$resultCH = json_decode(curl_exec($ch));
if (!(bool) $resultCH->success) {
$this->addError(LocalizationUtility::translate('validation.possible_robot', 'sf_event_mgt'), 1231423345);
}
} else {
throw new InvalidVariableException(LocalizationUtility::translate('error.no_secretKey', 'sf_event_mgt'), 1358349150);
}
}
}
作者:busynoggi
项目:cicregiste
/**
* @param array $behaviors
* @param $object
* @param $controllerContext
* @param $default
* @param array $extraConf
* @return bool|object
*/
public function executeBehaviors(array $behaviors, $object, $controllerContext, $default, $extraConf = array())
{
$behaviorResponse = false;
foreach ($behaviors as $behaviorClassName => $enabled) {
if (is_array($enabled) && $enabled['_typoScriptNodeValue'] == true || !is_array($enabled) && $enabled == true) {
if (is_array($enabled)) {
$conf = $enabled;
} else {
$conf = array();
}
$conf = array_merge_recursive($conf, $extraConf);
$behavior = $this->objectManager->create($behaviorClassName);
$behavior->setControllerContext($controllerContext);
$result = $behavior->execute($object, $conf);
if ($result) {
$behaviorResponse = $result;
}
}
}
if ($behaviorResponse == false) {
$behaviorResponse = $this->objectManager->create('CIC\\Cicregister\\Behaviors\\Response\\RenderAction');
$behaviorResponse->setValue($default);
}
return $behaviorResponse;
}