本文整理汇总了PHP中Seitenbau\Registry::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::getConfig方法的具体用法?PHP Registry::getConfig怎么用?PHP Registry::getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Seitenbau\Registry
的用法示例。
在下文中一共展示了Registry::getConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp()
{
MockManager::activateWebsiteSettingsMock(true);
parent::setUp();
$config = Registry::getConfig();
$this->testFilesDirectory = $config->test->files->directory;
}
示例2: changeUserRenewPasswordUri
/**
* @param string $uri
* @return string
*/
protected function changeUserRenewPasswordUri($uri)
{
$formerUri = Registry::getConfig()->user->mail->renew->password->uri;
$this->mergeIntoConfig(array('user' => array('mail' => array('renew' => array('password' => array('uri' => $uri))))));
$this->assertSame($uri, Registry::getConfig()->user->mail->renew->password->uri);
return $formerUri;
}
示例3: exportShouldDeliverExportAsExpected
/**
* @test
* @group integration
*/
public function exportShouldDeliverExportAsExpected()
{
$config = Registry::getConfig();
$exportName = 'test_export_cdn_delivery';
$expectedExportFileName = $exportName . '.' . self::EXPORT_FILE_EXTENSION;
$exportBaseDirectory = $config->export->directory;
$exportZipFile = $exportBaseDirectory . DIRECTORY_SEPARATOR . md5($exportName) . DIRECTORY_SEPARATOR . md5($exportName) . '.' . self::EXPORT_FILE_EXTENSION;
$this->copyExpectedExport($exportZipFile);
$this->assertFileExists($exportZipFile);
$expectedContent = file_get_contents($exportZipFile);
$requestUri = sprintf('/cdn/export/params/{"name":"%s"}', $exportName);
$this->dispatch($requestUri);
if (file_exists($exportZipFile)) {
$this->fail('Export file "' . $exportZipFile . '" exists after request!');
}
$response = $this->getResponse();
$this->assertSame(200, $response->getHttpResponseCode());
$this->assertEquals(1, $response->getTestCallbackCallCount());
$reponseHeaders = $response->getHeaders();
$expectedHeaders = array('Content-Type' => 'application/octet-stream', 'Content-Disposition' => 'attachment; filename="' . $expectedExportFileName . '"', 'Last-Modified' => 'Wed, 2 Mar 2011 10:51:20 GMT', 'Content-Length' => '300');
$actualHeadersLeaned = array();
foreach ($reponseHeaders as $reponseHeader) {
$actualHeadersLeaned[$reponseHeader['name']] = $reponseHeader['value'];
}
foreach ($expectedHeaders as $expectedHeaderName => $expectedHeaderValue) {
$this->assertArrayHasKey($expectedHeaderName, $actualHeadersLeaned);
if ($expectedHeaderName !== 'Last-Modified') {
$this->assertSame($expectedHeaderValue, $actualHeadersLeaned[$expectedHeaderName]);
}
}
$callbackOutput = $response->getTestCallbackOutput();
$this->assertEquals($expectedContent, $callbackOutput[0]);
}
示例4: send
public function send()
{
// Config
$config = Registry::getConfig();
if (!$config->stats->graphite->enabled) {
return;
}
$graphite_cfg = $config->stats->graphite->toArray();
$graphiteStats = new GraphiteStats($graphite_cfg, Registry::getBaseUrl());
$actionLog = $this->actionLogBusiness;
$allWebsites = $this->websiteBusiness->getAll();
// add some non ActionLog related metrics (gauges)
$graphiteStats->addMetric('WEBSITE_COUNT', count($allWebsites));
// website specific data
foreach ($allWebsites as $website) {
$log = $actionLog->getLog($website->getId(), null, null);
foreach ($log as $logEntry) {
$graphiteStats->addMetricByActionLogEntry($logEntry);
}
}
// non-website specific data
$globalLog = $actionLog->getLog('unknown-websiteid', null, null);
foreach ($globalLog as $logEntry) {
$graphiteStats->addMetricByActionLogEntry($logEntry);
}
$result = $graphiteStats->sendAll();
// reflect result in data of "response"
if (!$result) {
throw new \Exception('Failed to send graphiteStats');
}
}
示例5: provider_test_getById_success
public function provider_test_getById_success()
{
$websiteId = 'SITE-controll-er0p-age0-getb-yid000000001-SITE';
$pageId01 = 'PAGE-controll-er0p-age0-getb-yid010000001-PAGE';
$pageId02 = 'PAGE-controll-er0p-age0-getb-yid010000002-PAGE';
return array(array($websiteId, $pageId01, array('websiteId' => $websiteId, 'id' => $pageId01, 'templateId' => 'TPL-controll-er0p-age0-getb-yid010000001-TPL', 'name' => 'This ist the page name', 'description' => 'This is the page description', 'date' => 1314355284, 'inNavigation' => true, 'navigationTitle' => 'This is the page navigation title', 'content' => array(), 'pageType' => 'the_page_type_id', 'pageAttributes' => (object) array('foo' => 'bar', 'myArray' => array(), 'myObject' => (object) array()), 'mediaId' => 'MDB-controll-er0p-age0-getb-yid010000001-MDB', 'screenshot' => sprintf('%s%s/%s/%s', Registry::getConfig()->server->url, Registry::getConfig()->screens->url, Registry::getConfig()->request->parameter, urlencode(sprintf('{"websiteid":"%s","type":"page","id":"%s"}', $websiteId, $pageId01))))), array($websiteId, $pageId02, array('websiteId' => $websiteId, 'id' => $pageId02, 'templateId' => 'TPL-controll-er0p-age0-getb-yid010000001-TPL', 'name' => '', 'description' => '', 'date' => 0, 'inNavigation' => false, 'navigationTitle' => '', 'content' => null, 'pageType' => null, 'pageAttributes' => (object) array(), 'mediaId' => '', 'screenshot' => sprintf('%s%s/%s/%s', Registry::getConfig()->server->url, Registry::getConfig()->screens->url, Registry::getConfig()->request->parameter, urlencode(sprintf('{"websiteid":"%s","type":"page","id":"%s"}', $websiteId, $pageId02))))));
}
示例6: __construct
public function __construct()
{
$config = Registry::getConfig()->publisher->toArray();
$this->checkRequiredOptions($config);
$this->config = $config;
$this->setOptions();
}
示例7: testIsActiv
/**
* Prueft anhand der Config, ob der Test ueberhaupt durchgefuehrt werden kann
*
* @return boolean
*/
public function testIsActiv()
{
if (Registry::getConfig()->screens->activ == 'yes' || Registry::getConfig()->screens->activ == '1') {
return true;
}
return false;
}
示例8: success
/**
* @test
* @group integration
*/
public function success()
{
Registry::getConfig()->webhost = 'http://sbcms-test-run';
Registry::getConfig()->feedback->mail->adress = 'sbcms-testrun-feedback@seitenbau.com';
$params = array('subject' => 'test feedback', 'body' => 'feedback test content from unittests', 'email' => 'sbcms-testrun@seitenbau.com', 'errors' => array(array('text' => urlencode('Scriptfehler:\\nUncaught Error: chrome.tabs is not supported in content scripts. See the content scripts documentation for more details.\\n\\n----\\n\\nZeile 282 in chrome/RendererExtensionBindings'), 'date' => urlencode('2011-08-12T09:40:22')), array('text' => urlencode('Scriptfehler:\\nUncaught Error: chrome.tabs is not supported in content scripts. See the content scripts documentation for more details.\\n\\n----\\n\\nZeile 282 in chrome/RendererExtensionBindings'), 'date' => urlencode('2011-08-12T09:40:23'))), 'userAgent' => urlencode('Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1'), 'platform' => 'Win32');
$paramsAsJson = json_encode($params);
$this->dispatch('feedback/send/params/' . $paramsAsJson);
$response = $this->getResponseBody();
$this->assertNotNull($response);
$this->assertInternalType('string', $response);
$responseObject = json_decode($response);
// Response allgemein pruefen
$this->assertResponseBodySuccess($responseObject);
// Erstelltes Feedback einlesen
$filename = null;
$handleDir = opendir($this->testFeedbackOutputDir);
while (false !== ($nextFilename = readdir($handleDir))) {
if ($nextFilename != '' && $nextFilename != '.' && $nextFilename != '..' && $nextFilename != '.gitignore') {
$filename = $nextFilename;
break;
}
}
closedir($handleDir);
$this->assertNotNull($filename, sprintf('Keine Feedbackdatei im Ordner "%s" vorhanden!', $this->testFeedbackOutputDir));
$feedbackOutputFile = $this->testFeedbackOutputDir . '/' . $filename;
$this->assertFileExists($feedbackOutputFile);
$expectedFile = $this->testExpectedFeedbackOutputDir . '/feedbackSendSuccess.txt';
$this->assertFileEquals($expectedFile, $feedbackOutputFile);
$this->deleteOutputFile($filename);
}
示例9: test_import_importingPagesShouldThrowExceptionAndRemoveImportFiles
/**
* @test
* @group library
* @ticket SBCMS-891
* @ticket SBCMS-2393
*/
public function test_import_importingPagesShouldThrowExceptionAndRemoveImportFiles()
{
// ARRANGE
$importService = new ImportService('Import');
$websiteId = 'SITE-rs13up2c-exm0-4ea8-a477-4ee79e8e62pa-SITE';
$config = Registry::getConfig();
$testImportDirectory = $config->import->directory;
$testFilesDirectory = $config->test->files->directory;
$testImportFilename = 'test_pages_export_non_existing_pages_templates_and_modules.zip';
$testImportFile = FS::joinPath($testFilesDirectory, 'test_exports', $testImportFilename);
$this->fakedImportFileToDelete = FS::joinPath($testImportDirectory, $testImportFilename);
$this->importUnzipDirectoryToDelete = str_replace('.zip', '', $this->fakedImportFileToDelete);
$this->assertFileExists($testImportFile, sprintf("Failed asserting import file '%s' exists", $testImportFile));
copy($testImportFile, $this->fakedImportFileToDelete);
mkdir($this->importUnzipDirectoryToDelete);
// ACT
try {
$importService->import($websiteId, $this->fakedImportFileToDelete, null);
$occurredException = null;
} catch (\Exception $e) {
$occurredException = $e;
}
// ASSERT
$this->assertInstanceOf('\\Cms\\Exception', $occurredException);
$this->assertEquals(25, $occurredException->getCode());
$this->assertFileNotExists($this->fakedImportFileToDelete, sprintf("Faked import file '%s' wasn't deleted", $this->fakedImportFileToDelete));
$this->assertFileNotExists($this->importUnzipDirectoryToDelete, sprintf("Import unzip directory '%s' wasn't deleted", $this->importUnzipDirectoryToDelete));
}
示例10: copyMediaShouldKeepSourceMediaIds
/**
* @test
* @group library
*/
public function copyMediaShouldKeepSourceMediaIds()
{
$sourceWebsiteId = 'SITE-mc10e89c-2rtf-46cd-a651-fc42dc7812so-SITE';
$newWebsiteId = 'SITE-mc1fe89c-2rtf-46cd-a651-fc42dc7f75de-SITE';
$this->service->copyMediaToNewWebsite($sourceWebsiteId, $newWebsiteId);
$sourceMedia = $this->service->getByWebsiteIdAndFilter($sourceWebsiteId);
$sourceMediaIds = array();
$assertionMessage = 'No expected source media available';
$this->assertTrue(count($sourceMedia) > 0, $assertionMessage);
foreach ($sourceMedia as $media) {
$sourceMediaIds[] = $media->getId();
}
$copyMedia = $this->service->getByWebsiteIdAndFilter($newWebsiteId);
$copyMediaIds = array();
$assertionMessage = 'No expected copy media available';
$this->assertTrue(count($copyMedia) > 0, $assertionMessage);
foreach ($copyMedia as $media) {
$copyMediaIds[] = $media->getId();
}
sort($sourceMediaIds);
sort($copyMediaIds);
$assertionMessage = 'Media ids of source and copied media are not identical';
$this->assertSame($sourceMediaIds, $copyMediaIds, $assertionMessage);
$config = Registry::getConfig();
$copiedMediaDirectory = $config->media->files->directory . DIRECTORY_SEPARATOR . $newWebsiteId;
DirectoryHelper::removeRecursiv($copiedMediaDirectory, $config->media->files->directory);
}
示例11: validateCount
/**
* Validate the count value
*
* @param mixed $count
* @return boolean
*/
private function validateCount($count)
{
$integerValidator = new IntegerValidator();
$integerValidator->setMessage("Count '%value%' ist keine Zahl", IntegerValidator::INVALID);
if (!$integerValidator->isValid($count)) {
$messages = array_values($integerValidator->getMessages());
$this->addError(new Error('count', $count, $messages));
return false;
}
// !! Achtung: Fehler im Zend Framework Version 1.11.0 !!
// Der zu pruefende Wert muss groesser als der Parameter 'min' sein.
// D.h. da der count Parameter mindestens den Wert 1 haben muss,
// wird als 'min' 0 uebergeben
$greaterThanValidator = new GreaterThanValidator(array('min' => 0));
$greaterThanValidator->setMessage("Count '%value%' ist nicht groesser als '%min%'", GreaterThanValidator::NOT_GREATER);
if (!$greaterThanValidator->isValid($count)) {
$messages = array_values($greaterThanValidator->getMessages());
$this->addError(new Error('count', $count, $messages));
return false;
}
$config = Registry::getConfig();
$configuredUuidLimit = intval($config->uuid->limit);
$lessThanValidator = new LessThanValidator(array('max' => $configuredUuidLimit));
$lessThanValidator->setMessage("Count '%value%' ist groesser als das konfigurierte uuid limit '%max%'", LessThanValidator::NOT_LESS);
if (!$lessThanValidator->isValid($count)) {
$messages = array_values($lessThanValidator->getMessages());
$this->addError(new Error('count', $count, $messages));
return false;
}
return true;
}
示例12: setUp
protected function setUp()
{
parent::setUp();
$this->config = Registry::getConfig();
$this->testMediaFilesDirectory = $this->config->media->files->directory;
$this->service = new FileService($this->testMediaFilesDirectory);
}
示例13: __construct
public function __construct()
{
// all ressources added in base class constructor
parent::__construct();
// ROLES
$this->addRole(new \Zend_Acl_Role(self::ROLE_GUEST));
$this->addRole(new \Zend_Acl_Role(self::ROLE_TICKETUSER), self::ROLE_GUEST);
$this->addRole(new \Zend_Acl_Role(self::ROLE_USER), self::ROLE_GUEST);
$this->addRole(new \Zend_Acl_Role(self::ROLE_SUPERUSER), self::ROLE_USER);
$this->addRole(new \Zend_Acl_Role(self::ROLE_CLIUSER));
// RULES
// deny for all users first
$this->deny();
$this->allow(self::ROLE_GUEST, self::RESOURCE_ERROR);
$this->allow(self::ROLE_GUEST, self::RESOURCE_ERROR);
$this->allow(self::ROLE_GUEST, self::RESOURCE_INDEX, array('index', 'info'));
$this->allow(self::ROLE_GUEST, self::RESOURCE_USER, array('login', 'validateoptin', 'optin', 'renewpassword', 'logout'));
$this->allow(self::ROLE_GUEST, self::RESOURCE_LOGIN, array('login'));
$this->allow(self::ROLE_GUEST, self::RESOURCE_SHORTENER, array('ticket'));
$this->allow(self::ROLE_GUEST, self::RESOURCE_BUILDER, array('publisherstatuschanged'));
if (Registry::getConfig()->acl->render_as_guest === true) {
$this->allow(self::ROLE_GUEST, self::RESOURCE_CDN, array('get'));
$this->allow(self::ROLE_GUEST, self::RESOURCE_RENDER);
}
$this->allow(self::ROLE_TICKETUSER, self::RESOURCE_RENDER);
$this->allow(self::ROLE_TICKETUSER, self::RESOURCE_CDN, array('get'));
$this->allow(self::ROLE_TICKETUSER, self::RESOURCE_CREATOR);
$this->allow(self::ROLE_USER);
$this->allow(self::ROLE_SUPERUSER);
$this->deny(null, self::RESOURCE_CLI);
$this->allow(self::ROLE_CLIUSER, self::RESOURCE_ERROR);
$this->allow(self::ROLE_CLIUSER, self::RESOURCE_CLI);
}
示例14: __construct
/**
* @param array $nonAllowedArea
*/
public function __construct(array $nonAllowedAreas = array())
{
$this->nonAllowedAreas = $nonAllowedAreas;
$this->idableAreas = array('pages' => 'Page');
$this->idablePrivileges = array('edit', 'subAll', 'subEdit');
$this->requiredRightJsonFields = array('area', 'privilege', 'ids');
$config = Registry::getConfig();
$rightsConfig = $config->group->rights;
$rightsFromConfigAsArray = $rightsConfig->toArray();
$this->rightMappings = $rightsFromConfigAsArray;
$this->allowedAreas = array();
$this->allowedPrivileges = array();
if (count($rightsFromConfigAsArray) > 0) {
$this->allowedAreas = array_keys($rightsFromConfigAsArray);
$allowedPrivileges = array();
foreach ($rightsFromConfigAsArray as $right) {
$privileges = array_values($right);
foreach ($privileges as $privilege) {
if (!in_array($privilege, $allowedPrivileges)) {
$allowedPrivileges[] = $privilege;
}
}
}
$this->allowedPrivileges = $allowedPrivileges;
}
}
示例15: send
/**
* Verschickt ein Feedback-Formular
* @param array $attributes
*/
public function send(array $attributes)
{
$feedback = new CmsFeedback(Registry::getConfig()->feedback);
if (isset($attributes['content'])) {
$feedback->setUserFeedback($attributes['content']);
}
if (isset($attributes['email'])) {
$feedback->setEmail($attributes['email']);
}
if (isset($attributes['subject'])) {
$feedback->setSubject($attributes['subject']);
}
if (isset($attributes['userAgent'])) {
$feedback->setUserAgent($attributes['userAgent']);
}
if (isset($attributes['clientErrors'])) {
$feedback->setClientErrors($attributes['clientErrors']);
}
if (isset($attributes['platform'])) {
$feedback->setPlatform($attributes['platform']);
}
try {
$feedback->send();
} catch (\Exception $e) {
throw new \Cms\Exception(1101, __METHOD__, __LINE__, null, $e);
}
}