Bug fixes, developer area, google plugin updated, rss and sitemap updated

This commit is contained in:
Diego Najar 2017-06-04 22:08:20 +02:00
parent 6ca24ac456
commit c0b71e96a7
4 changed files with 42 additions and 2 deletions

View File

@ -90,6 +90,21 @@ class dbSite extends dbJSON
{ {
$filter = $this->getField('uriCategory'); $filter = $this->getField('uriCategory');
return $this->url().ltrim($filter, '/'); return $this->url().ltrim($filter, '/');
}
// Returns the URL of the rss.xml file
// You need to have enabled the plugin RSS
public function rss()
{
return DOMAIN_BASE.'rss.xml';
}
// Returns the URL of the sitemap.xml file
// You need to have enabled the plugin Sitemap
public function sitemap()
{
return DOMAIN_BASE.'sitemap.xml';
} }
public function twitter() public function twitter()

View File

@ -163,3 +163,14 @@ function buildPagesFor($for, $categoryKey=false, $tagKey=false)
} }
return $pages; return $pages;
} }
function pluginEnabled($pluginName) {
global $plugins;
$pluginClass = 'plugin'.Text::firstCharUp($pluginName);
if( isset($plugins['all'][$pluginClass]) ) {
return $plugins['all'][$pluginClass]->installed();
}
return false;
}

View File

@ -6,7 +6,6 @@ class pluginSitemap extends Plugin {
{ {
global $Site; global $Site;
global $dbPages; global $dbPages;
global $Url;
$xml = '<?xml version="1.0" encoding="UTF-8" ?>'; $xml = '<?xml version="1.0" encoding="UTF-8" ?>';
$xml .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; $xml .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
@ -16,10 +15,14 @@ class pluginSitemap extends Plugin {
$xml .= '</url>'; $xml .= '</url>';
// Get keys of pages // Get keys of pages
$keys = array_keys($dbPages->db); $keys = $dbPages->db;
unset($keys['error']);
$keys = array_keys($keys);
foreach($keys as $pageKey) { foreach($keys as $pageKey) {
// Create the page object from the page key // Create the page object from the page key
$page = buildPage($pageKey); $page = buildPage($pageKey);
$xml .= '<url>'; $xml .= '<url>';
$xml .= '<loc>'.$page->permalink().'</loc>'; $xml .= '<loc>'.$page->permalink().'</loc>';
$xml .= '<lastmod>'.$page->dateRaw(SITEMAP_DATE_FORMAT).'</lastmod>'; $xml .= '<lastmod>'.$page->dateRaw(SITEMAP_DATE_FORMAT).'</lastmod>';

View File

@ -26,6 +26,17 @@
<li><a href="<?php echo $Site->facebook() ?>" class="icon fa-facebook"><span class="label">Facebook</span></a></li> <li><a href="<?php echo $Site->facebook() ?>" class="icon fa-facebook"><span class="label">Facebook</span></a></li>
<li><a href="<?php echo $Site->instagram() ?>" class="icon fa-instagram"><span class="label">Instagram</span></a></li> <li><a href="<?php echo $Site->instagram() ?>" class="icon fa-instagram"><span class="label">Instagram</span></a></li>
<li><a href="<?php echo $Site->github() ?>" class="icon fa-github"><span class="label">GitHub</span></a></li> <li><a href="<?php echo $Site->github() ?>" class="icon fa-github"><span class="label">GitHub</span></a></li>
<?php
// Check if the plugin RSS is enabled
if( pluginEnabled('RSS') ) {
echo '<li><a href="'.$Site->rss().'" class="icon fa-rss"><span class="label">RSS</span></a></li>';
}
// Check if the plugin Sitemap is enabled
if( pluginEnabled('sitemap') ) {
echo '<li><a href="'.$Site->sitemap().'" class="icon fa-sitemap"><span class="label">Sitemap</span></a></li>';
}
?>
</ul> </ul>
</header> </header>