* @package WB * @subpackage datasource */ WBClass::load('WBDatasource_Sitemap' ); /** * Datasource Sitemap Blog * * Add recent blog posts to sitemap * * @todo configure priority and limit * @version 0.2.0 * @package WB * @subpackage datasource */ class WBDatasource_Sitemap_Blog extends WBDatasource_Sitemap { /** * @var WBBlog_Tool */ private $blog; /** * Find all the URLs * * Get recent blog posts */ public function find() { $this->blog = WBClass::create('WBBlog_Tool'); $options = array( 'limit' => 500 ); $priority = 1.1; $list = $this->blog->getList($options); foreach ($list as $i => $l) { // decrease priority if (0 == ($i % 100)) { $priority -= 0.1; $this->setPriority($priority); } $this->blog->loadArticleByData($l); $path = $this->blog->getArticlePath(); $path = substr($path, strlen('[[PROTOCOL]]://[[SERVER]][[SELF]]')); $this->setPath($path); $this->notify(); } } }