当前位置: 首页>>代码示例>>PHP>>正文


PHP Seitenbau\Registry类代码示例

本文整理汇总了PHP中Seitenbau\Registry的典型用法代码示例。如果您正苦于以下问题:PHP Registry类的具体用法?PHP Registry怎么用?PHP Registry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Registry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 protected function setUp()
 {
     MockManager::activateWebsiteSettingsMock(true);
     parent::setUp();
     $config = Registry::getConfig();
     $this->testFilesDirectory = $config->test->files->directory;
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:7,代码来源:WebsiteSettingsTest.php

示例2: __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;
     }
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:29,代码来源:UserRight.php

示例3: successfullyDecompressGzRawPostData

 /**
  * @test
  * @group library
  */
 public function successfullyDecompressGzRawPostData()
 {
     $compressedRequestFileDirectory = Registry::getConfig()->test->request->storage->directory . DIRECTORY_SEPARATOR . 'compressed' . DIRECTORY_SEPARATOR;
     $compressedRawBodyFile = $compressedRequestFileDirectory . 'gzCompressed.body';
     $decompressedParamFile = $compressedRequestFileDirectory . 'gzDeompressedParams.php';
     $this->assertFileExists($compressedRawBodyFile, 'Komprimierte Test-Request-Datei nicht gefunden: ' . $compressedRawBodyFile);
     $this->assertFileExists($decompressedParamFile, 'Dekomprimierte Test-Param-Variablen-Datei nicht gefunden: ' . $decompressedParamFile);
     // Dekomprimierte Werte ermitteln
     $decompressedParams = (include $decompressedParamFile);
     // Request-Objekt erzeugen
     $request = new HttpRequestCompressed();
     // Raw Post Daten setzen
     $_SERVER['REQUEST_METHOD'] = 'POST';
     $_SERVER['HTTP_X_CMS_ENCODING'] = 'gz';
     $reflectionClass = new \ReflectionClass('Cms\\Controller\\Request\\HttpCompressed');
     $reflectionPropertyDecompressedFlag = $reflectionClass->getProperty('postDataDecompressed');
     $reflectionPropertyDecompressedFlag->setAccessible(true);
     $reflectionPropertyDecompressedFlag->setValue($request, false);
     $reflectionPropertyRawBody = $reflectionClass->getProperty('_rawBody');
     $reflectionPropertyRawBody->setAccessible(true);
     $reflectionPropertyRawBody->setValue($request, file_get_contents($compressedRawBodyFile));
     // Dekomprimieren
     $request->decompressRequest();
     // Dekomprimierung pruefen
     $jsonParams = $request->getParam(\Cms\Request\Base::REQUEST_PARAMETER);
     $this->assertInternalType('string', $jsonParams);
     $params = json_decode($jsonParams, true);
     $this->assertInternalType('array', $params);
     $this->assertSame($decompressedParams, $params);
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:34,代码来源:HttpCompressedTest.php

示例4: 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]);
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:37,代码来源:ExportTest.php

示例5: 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');
     }
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:31,代码来源:SendStatisticToGraphite.php

示例6: 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))))));
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:7,代码来源:GetByIdTest.php

示例7: __construct

 public function __construct()
 {
     $config = Registry::getConfig()->publisher->toArray();
     $this->checkRequiredOptions($config);
     $this->config = $config;
     $this->setOptions();
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:7,代码来源:Publisher.php

示例8: 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;
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:12,代码来源:ShootPageTest.php

示例9: authCallback

 /**
  * @param string $username
  * @param string $password
  *
  * @return bool
  */
 public function authCallback($username, $password)
 {
     try {
         $accessManager = AccessManager::singleton();
         $authResult = $accessManager->checkLogin($username, $password);
         // module development must be enabled to login via WebDav
         $quota = new \Cms\Quota();
         if (!$quota->getModuleQuota()->getEnableDev()) {
             Registry::getLogger()->log(__METHOD__, __LINE__, sprintf('DAV access denied: module development is disabled (%s)', $username), SbLog::ERR);
             return false;
         }
         // login success?
         if (!$accessManager->isAuthResultValid($authResult)) {
             Registry::getLogger()->log(__METHOD__, __LINE__, sprintf('DAV access denied: incorrect user credentials (%s)', $username), SbLog::NOTICE);
             return false;
         }
         // only superusers are allowed to login via webdav
         $identity = $authResult->getIdentity();
         if (!is_array($identity) || !isset($identity['superuser']) || $identity['superuser'] != true) {
             Registry::getLogger()->log(__METHOD__, __LINE__, sprintf('DAV access denied: user is not a superuser (%s)', $username), SbLog::ERR);
             return false;
         }
     } catch (\Exception $e) {
         Registry::getLogger()->logException(__METHOD__, __LINE__, $e, SbLog::ERR);
         return false;
     }
     // authentication successful
     return true;
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:35,代码来源:Server.php

示例10: loginAction

 public function loginAction()
 {
     $config = Registry::getConfig();
     $this->view->loginFailed = false;
     // Bereits angemeldete User direkt weiterleiten
     if ($this->isUserDeclared()) {
         $this->_redirect(base64_decode($this->getRequest()->getParam('url')), array('prependBase' => false));
     }
     if ($this->getRequest()->getPost('login')) {
         $username = $this->getRequest()->getPost('username');
         $userpassword = $this->getRequest()->getPost('password');
         if ($this->tryUserLogin($username, $userpassword)) {
             $this->_redirect(base64_decode($this->getRequest()->getPost('url')), array('prependBase' => false));
         }
         // Ticket-Login mit den Zugangsdaten auf den Ticket-Service weiterleiten
         if ($this->getRequest()->getPost('ticket')) {
             $credentials = \Zend_Json::encode(array('username' => $username, 'password' => $userpassword));
             $url = base64_decode($this->getRequest()->getParam('url'));
             if (substr($url, -1, 1) != '/') {
                 $url .= '/';
             }
             $url .= $config->request->parameter . '/' . urlencode($credentials);
             $this->_redirect($url, array('prependBase' => false));
         }
         $this->view->loginFailed = true;
     }
     $this->view->url = $this->getRequest()->getParam('url');
     $this->view->useClientTemplate = realpath($config->client->template->login);
     // Ticket-Daten aufnehmen
     if ($this->getRequest()->getParam('ticket') == 2) {
         $this->view->loginFailed = true;
     }
     $this->view->ticket = $this->getRequest()->getParam('ticket');
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:34,代码来源:LoginController.php

示例11: 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));
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:34,代码来源:ImportPagesTest.php

示例12: 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);
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:31,代码来源:CopyMediaToNewWebsiteTest.php

示例13: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->config = Registry::getConfig();
     $this->testMediaFilesDirectory = $this->config->media->files->directory;
     $this->service = new FileService($this->testMediaFilesDirectory);
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:7,代码来源:CopyMediaFileToNewWebsiteTest.php

示例14: 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;
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:37,代码来源:Uuid.php

示例15: 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;
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:11,代码来源:ServiceTestCase.php


注:本文中的Seitenbau\Registry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。