本文整理汇总了PHP中Seitenbau\Registry::getBaseUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::getBaseUrl方法的具体用法?PHP Registry::getBaseUrl怎么用?PHP Registry::getBaseUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Seitenbau\Registry
的用法示例。
在下文中一共展示了Registry::getBaseUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
}
示例2: send
public function send()
{
// Config
$config = Registry::getConfig();
if (!$config->stats->segmentio->enabled) {
return;
}
$stats_cfg = $config->stats->segmentio->toArray();
$sio = new SegmentIoStats($stats_cfg, Registry::getBaseUrl());
$tracking_id = $this->getTrackingId();
if (empty($tracking_id)) {
return;
// end here
}
$propertiesReport = array();
$propertiesReport['calculated_stats'] = $this->addCalculatedStats($sio, $tracking_id);
// initial user data or new log entries
if ($this->isFirstSubmit()) {
// get all log entries
$logEntries = $this->actionLogBusiness->getLogSinceLastAction(null);
// remove legacy action entries
$this->removeActionsWithLegacyName($logEntries);
} else {
// get new log entries (since last successful send operation)
$logEntries = $this->actionLogBusiness->getLogSinceLastAction(CliBusiness::SPACE_SUBMITTED_LOG);
}
// add log entries to queue
$this->addLogEntries($sio, $tracking_id, $logEntries);
// send to segment.io and log the sending if successful
if ($sio->sendAll()) {
$this->logSuccessfulSent($propertiesReport);
}
}
示例3: setUp
protected function setUp()
{
parent::setUp();
$weburl = parse_url(Registry::getBaseUrl());
$this->spaceHost = preg_replace('/\\.$/', '', $weburl['host']);
$this->cfg_segmentio = Registry::getConfig()->stats->segmentio->toArray();
$this->analyticsLogFile = $this->cfg_segmentio['api_options']['filename'];
FS::rmFile($this->analyticsLogFile);
}
示例4: success
/**
* @test
* @group library
* @requires extension phpwkhtmltox
* @dataProvider successProvider
*/
public function success($fileTyp)
{
$this->markTestSkipped('Disabled because of memory problems');
$this->config->filetype = $fileTyp;
$screenshotHandler = new Screenshot\Type\Systemcallwkhtmltoimage($this->config->toArray());
$destinationFile = $this->config->directory . '/systemcallwkhtmltoimageTest/test.' . $fileTyp;
$this->assertFileNotExists($destinationFile);
$pageId = 'PAGE-033d84e8-cc3e-4a1f-a408-b8fa374af75f-PAGE';
$websiteId = 'SITE-a344abb2-2a96-4836-b847-1ab0571b1e6d-SITE';
$url = Registry::getBaseUrl()->webhost . Registry::getConfig()->server->url . '/render/page/' . Registry::getConfig()->request->parameter . '/' . urlencode('{"websiteid":"' . $websiteId . '","pageid":"' . $pageId . '",' . '"mode":"preview"}');
$shootId = time();
$screenshotHandler->shoot($shootId, $url, $destinationFile);
$expectedFile = Registry::getConfig()->test->output->screenshot->directory . '/systemcallwkhtmltoimage/expectedSuccess.' . $fileTyp;
$this->assertFileExistsWithDelay($destinationFile);
// Die Pruefung kann ausgeschaltet werden -> auf dem Build-System ist
// keine CMS-Oberflaeche vorhanden, welche fuer diesen Test notwendig waere
if ($this->config->systemcallwkhtmltoimage->check->files->equal != false) {
$this->assertFileEquals($expectedFile, $destinationFile);
}
}
示例5: createTicket
/**
* @param string $websiteId
* @param boolean $isRedirect
* @param boolean $isGet
* @param string $requestConfig
* @param integer $ticketLifetime
* @param integer $remainingCalls
* @param integer $sessionLifetime
* @param array $credentials
* @param array $additionalTicketParams
* @param bool $useInternalUrl
* @return array 'ticket' => Cms\Data\Ticket, 'ticketUrl' => Ticket-Url
*/
public function createTicket($websiteId, $isRedirect, $isGet, $requestConfig, $ticketLifetime = null, $remainingCalls = null, $sessionLifetime = null, $credentials = null, $additionalTicketParams = null, $useInternalUrl = false)
{
// Alte Tickets entfernen
$this->execute('deleteInvalidTickets', array());
// Default-Werte setzen
$config = Registry::getConfig();
if (!isset($ticketLifetime)) {
$ticketLifetime = $config->accessticket->ticketLifetime;
}
if (!isset($remainingCalls)) {
$remainingCalls = $config->accessticket->remainingCalls;
}
// evtl. Schutz umformen
if (isset($credentials)) {
if (is_array($credentials)) {
$credentials = \Zend_Json::encode($credentials);
} elseif (!is_scalar($credentials)) {
throw new CmsException(1307, __METHOD__, __LINE__);
}
}
// Neues Ticket erstellen
$ticket = $this->execute('create', array($websiteId, $isRedirect, $isGet, $requestConfig, $ticketLifetime, $remainingCalls, $sessionLifetime, $credentials));
// evtl. Ticket-Parameter umformen
if (isset($additionalTicketParams)) {
if (is_array($additionalTicketParams)) {
$additionalTicketParams = \Zend_Json::encode($additionalTicketParams);
} elseif (!is_scalar($additionalTicketParams)) {
throw new CmsException(1301, __METHOD__, __LINE__);
}
if (!empty($additionalTicketParams)) {
$additionalTicketParams = Registry::getConfig()->request->parameter . '/' . urlencode($additionalTicketParams);
}
}
// Basisurl uebernehmen, Ticket ID und weitere Parameter setzen
$baseUrl = Registry::getBaseUrl($useInternalUrl);
$ticketUrl = $baseUrl . $config->server->url . $config->accessticket->url;
$ticketUrl = str_replace(':ticket', $ticket->getId(), $ticketUrl);
$ticketUrl = str_replace(':params', $additionalTicketParams, $ticketUrl);
// Ticket und Ticket-Url zurueckgeben
return array('ticket' => $ticket, 'ticketUrl' => $ticketUrl);
}
示例6: mailTextShouldContainConfiguredUri
/**
* @test
* @group library
*/
public function mailTextShouldContainConfiguredUri()
{
$userOptinUriPath = '/bar/';
$formerOptinUri = $this->changeUserOptinUri($userOptinUriPath);
$user = new \Cms\Data\User();
$user->setId('USER-test5421shd-USER');
$user->setFirstname('John');
$user->setLastname('Doe');
$user->setEmail('john.doe@test.de');
$optin = new \Orm\Entity\OptIn();
$optin->setCode('testRS01');
$optin->setUserId($user->getId());
$optin->setUser($user);
$mail = $this->service->getOptinMail($optin);
$this->changeUserOptinUri($formerOptinUri);
$mailContent = $mail->getBodyText('true');
$mailContent = str_replace("=\r\n", "", $mailContent);
$mailContent = str_replace("=\n", "", $mailContent);
$optinUrl = Registry::getBaseUrl() . $userOptinUriPath . '?t=';
$this->assertTrue(strchr($mailContent, $optinUrl) !== false);
$this->assertTrue(strchr($mailContent, $optin->getCode()) !== false);
}
示例7: assertRegisterMailSendSuccessfully
protected function assertRegisterMailSendSuccessfully($optin, $user, $actualMailContent)
{
$config = Registry::getConfig();
$expectedMailContent = OptinTestHelper::createMailContentFromMailTemplate(FS::joinPath(realpath($config->test->files->directory), 'mails', 'optin.txt'), array('@@OPTIN_CODE@@' => $optin->getCode(), '@@WEBHOST@@' => Registry::getBaseUrl(), '@@FROM_NAME@@' => $config->user->mail->optin->from->name, '@@FROM_ADRESS@@' => $config->user->mail->optin->from->address, '@@USER_FIRSTNAME@@' => $user->getFirstname(), '@@USER_LASTNAME@@' => $user->getLastname(), '@@USER_EMAIL@@' => $user->getEmail()));
$this->assertEquals(OptinTestHelper::clearLineBreaksInMailContent($expectedMailContent), OptinTestHelper::clearLineBreaksInMailContent($actualMailContent));
}
示例8: getRenewPasswordMail
/**
* @param \Orm\Entity\OptIn $optin
* @param string $charset
* @return \Cms\Mail
*/
public function getRenewPasswordMail(\Orm\Entity\OptIn $optin, $charset = 'utf-8')
{
$config = Registry::getConfig();
$baseUrl = Registry::getBaseUrl();
$optinUser = $optin->getUser();
$locale = self::getLocale($optinUser->getLanguage());
$fromUser = $this->getMailFromUserData(array('email' => $config->user->mail->renew->password->from->address, 'name' => $config->user->mail->renew->password->from->name));
$this->view->clearVars();
$this->view->optin = $optin;
$this->view->optinUser = $optinUser;
$this->view->optinUrl = $baseUrl . $config->user->mail->renew->password->uri;
$this->view->spaceUrl = $baseUrl;
$this->view->fromName = $fromUser['name'];
$this->view->fromEmail = $fromUser['email'];
$renewMail = new \Cms\Mail($charset);
$renewMail->setBodyText($this->view->render($this->getTemplateFilename(__FUNCTION__, $locale)));
// the subject is set in mail template
$subject = $this->view->subject;
$renewMail->setFrom($fromUser['email'], $fromUser['name']);
$renewMail->setSubject($subject);
$renewMail->addTo($optinUser->getEmail(), $optinUser->getFirstname() . ' ' . $optinUser->getLastname());
return $renewMail;
}
示例9: registerUser
/**
* @param $userId
*
* @return array
*/
public function registerUser($userId)
{
// init
$data = array();
$userBusiness = $this->getBusiness('User');
// Benutzer ermitteln
$data['user'] = $userBusiness->getById($userId);
// Registrier-Token erzeugen
$tokens = $userBusiness->register(array($userId), false);
foreach ($tokens as $token) {
if ($userId === $token->getUserid()) {
$data['token'] = $token->getCode();
break;
}
}
// Registrier-Url ermitteln
$config = Registry::getConfig();
$data['tokenUrl'] = sprintf("%s/t=%s&u=%s", Registry::getBaseUrl(), urlencode($data['token']), urlencode($data['user']->getEmail()));
// Benutzer und Registrier-Token zurueckgeben
return $data;
}
示例10: __construct
public function __construct(\Zend_Config $config)
{
$adapter = $this->initConfigAdapter($config);
$this->setAdapter($adapter);
$this->setWebhost(Registry::getBaseUrl());
}
示例11: calculateShootId
/**
* Ermittelt die Id fuer einen Screenshot
*
* @param string $websiteId
* @param string $type
* @param string $id
* @param string $timestamp
* @return string
*/
public function calculateShootId($websiteId, $type, $id, $timestamp)
{
return md5(Registry::getBaseUrl() . '/' . $websiteId . '/' . $type . '/' . $id . '/' . $timestamp);
}
示例12: getDomain
protected function getDomain()
{
$config = $this->bootstrap('config');
$webUrl = parse_url(Registry::getBaseUrl());
return $webUrl['host'];
}
示例13: createPageUrlHelper
/**
* Creates a CMS based Page URL Helper (used to get URL for rendering Pages, Templates and their
* CSS)
*
* @param $websiteId
* @param $pageOrTemplateId
* @param $isTemplate
* @param $mode
*
* @return IPageUrlHelper
*/
protected function createPageUrlHelper($websiteId, $pageOrTemplateId, $isTemplate, $mode)
{
return new CmsPageUrlHelper($websiteId, $pageOrTemplateId, $isTemplate, $this->getRenderPageServiceUrl(), $this->getRenderPageCssServiceUrl(), $this->getRenderTemplateServiceUrl(), $this->getRenderTemplateCssServiceUrl(), $mode, Registry::getBaseUrl());
}
示例14: getProtocolFromBaseUrl
/**
* @return string|null
*/
protected function getProtocolFromBaseUrl()
{
$baseUrlParted = parse_url(Registry::getBaseUrl());
if (!isset($baseUrlParted['scheme']) || empty($baseUrlParted['scheme'])) {
return null;
}
return $baseUrlParted['scheme'] . '://';
}
示例15: getStatusChagedUrlForPublishingId
/**
* @param string $websiteId
* @param string $buildId
* @param string $publishingId
* @return array
*/
private function getStatusChagedUrlForPublishingId($websiteId, $buildId, $publishingId)
{
$config = Registry::getConfig();
$paramsAsjson = array('websiteId' => $websiteId, 'buildId' => $buildId, 'publishedId' => $publishingId);
return sprintf("%s%s/builder/publisherstatuschanged/params/%s", Registry::getBaseUrl(), $config->server->url, urlencode(SbJson::encode($paramsAsjson)));
}