Пример #1
0
 /**
  * @dataProvider lastmodProvider
  */
 public function testLastmodFormatting($lastmod, $changefreq, $expected_lastmod)
 {
     $url = new Url();
     $url->setLastmod($lastmod);
     $url->setChangefreq($changefreq);
     $this->assertEquals($expected_lastmod, $url->getLastmod());
 }
 public function populate(Sitemap $sitemap)
 {
     foreach ($this->options['routes'] as $route) {
         $route = array_merge($this->defaultRoute, $route);
         $url = new Url();
         $url->setLoc($this->router->generate($route['name'], $route['params']));
         $url->setChangefreq($route['changefreq'] ?: $this->options['changefreq']);
         $url->setLastmod($route['lastmod'] ?: $this->options['lastmod']);
         $url->setPriority($route['priority'] ?: $this->options['priority']);
         $sitemap->add($url);
     }
 }
 protected function resultToUrl($result)
 {
     $url = new Url();
     $url->setLoc($this->getResultLoc($result));
     if ($this->options['priority'] !== null) {
         $url->setPriority($this->options['priority']);
     }
     if ($this->options['changefreq'] !== null) {
         $url->setChangefreq($this->options['changefreq']);
     }
     if ($this->options['lastmod'] !== null) {
         $url->setLastmod($this->getColumnValue($result, $this->options['lastmod']));
     }
     return $url;
 }
Пример #4
0
 public function populate(Sitemap $sitemap)
 {
     $url = new Url();
     $url->setLoc('http://www.google.fr');
     $url->setChangefreq(Url::CHANGEFREQ_NEVER);
     $url->setLastmod('2012-12-19 02:28');
     $video = new Video();
     $video->setThumbnailLoc('http://www.example.com/thumbs/123.jpg');
     $video->setTitle('Grilling steaks for summer');
     $video->setDescription('Alkis shows you how to get perfectly done steaks every time');
     $url->addVideo($video);
     $sitemap->add($url);
     $url = new Url();
     $url->setLoc('http://github.com');
     $url->setChangefreq(Url::CHANGEFREQ_ALWAYS);
     $url->setPriority(0.2);
     $sitemap->add($url);
 }