getUrl() public method

Get a URL path definition.
public getUrl ( string $name, boolean $includeBasePath = true ) : string
$name string
$includeBasePath boolean
return string
Exemplo n.º 1
0
 /**
  * Add base snippets to the response.
  */
 protected function addSnippets()
 {
     $this->queue->add(Target::END_OF_HEAD, '<meta name="generator" content="Bolt">');
     if ($this->config->get('general/canonical')) {
         $canonical = $this->resources->getUrl('canonicalurl');
         $this->queue->add(Target::END_OF_HEAD, $this->encode('<link rel="canonical" href="%s">', $canonical));
     }
     if ($favicon = $this->config->get('general/favicon')) {
         $host = $this->resources->getUrl('hosturl');
         $theme = $this->resources->getUrl('theme');
         $this->queue->add(Target::END_OF_HEAD, $this->encode('<link rel="shortcut icon" href="%s%s%s">', $host, $theme, $favicon));
     }
 }
Exemplo n.º 2
0
 public function testConfigsWithNonRootDirectory()
 {
     $request = Request::create('/sub/directory/bolt/test/location', 'GET', [], [], [], ['SCRIPT_NAME' => '/sub/directory/index.php', 'PHP_SELF' => '/sub/directory/index.php', 'SCRIPT_FILENAME' => '/path/to/sub/directory/index.php']);
     $config = new ResourceManager(new \Pimple(['rootpath' => TEST_ROOT, 'request' => $request, 'pathmanager' => new PlatformFileSystemPathFactory()]));
     $app = new Application(['resources' => $config]);
     $app['config']->set('general/branding/path', '/custom');
     $config->initialize();
     $this->assertEquals('/sub/directory/custom/', $config->getUrl('bolt'));
     $this->assertEquals('/sub/directory/custom/files/files/', $app['config']->get('general/wysiwyg/filebrowser/imageBrowseUrl'));
 }
 public function testConfigsWithNonRootDirectory()
 {
     $request = Request::create("/sub/directory/bolt/test/location", "GET", array(), array(), array(), array('SCRIPT_NAME' => '/sub/directory/index.php', 'PHP_SELF' => '/sub/directory/index.php', 'SCRIPT_FILENAME' => '/path/to/sub/directory/index.php'));
     $config = new ResourceManager(TEST_ROOT, $request);
     $app = new Application(array('resources' => $config));
     $app['config']->set('general/branding/path', '/custom');
     $config->initialize();
     $this->assertEquals('/sub/directory/custom/', $config->getUrl('bolt'));
     $this->assertEquals('/sub/directory/custom/files/files/', $app['config']->get('general/wysiwyg/filebrowser/imageBrowseUrl'));
 }