/** * Ensures everything works as expected * * @expectedException \Conjoon\Net\Exception */ public function testGetCurrentUriBase() { $env = new \Conjoon\Net\Environment(); $this->assertSame($env->getCurrentUriBase(), ''); }
/** * Helper function for setting up and returning a HtmlPurifier instance * for sanitizing html mail bodies. * * @param boolean $allowExternals whether external resources should be * allowed or not * * @return \HtmlPurifier */ public function getHtmlPurifierHelper($allowExternals) { /** * @see \Conjoon\Util\Environment */ require_once 'Conjoon/Net/Environment.php'; $cnEnvironment = new \Conjoon\Net\Environment(); $htmlPurifierConfig = $this->getBaseHtmlPurifierConfig(); $config = $this->getApplicationConfiguration(); $htmlPurifierConfig->set('HTML.Trusted', false); $htmlPurifierConfig->set('CSS.AllowTricky', false); $htmlPurifierConfig->set('CSS.AllowImportant', false); $htmlPurifierConfig->set('CSS.Trusted', false); $htmlPurifierConfig->set('URI.DisableExternalResources', !$allowExternals); $uri = $htmlPurifierConfig->getDefinition('URI'); $cnUri = $cnEnvironment->getCurrentUriBase(); $cnUri = $cnUri->setPath(rtrim($config->environment->base_url, '/') . '/' . '/default/index/resource.not.available'); $uri->addFilter(new \Conjoon\Vendor\HtmlPurifier\UriFilter\ResourceNotAvailableUriFilter($cnUri), $htmlPurifierConfig); return new \HTMLPurifier($htmlPurifierConfig); }