From be0030ee3e1c79b0badab9583cfbf5e5ff43e8e0 Mon Sep 17 00:00:00 2001 From: Nick Crossland Date: Thu, 2 Feb 2012 15:21:10 +0000 Subject: [PATCH] Add "excludeTemplates" parameter (opposite of "allowedTemplates" For when you want all templates EXCEPT specific ones --- .../model/googlesitemap/googlesitemap.class.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/components/googlesitemap/model/googlesitemap/googlesitemap.class.php b/core/components/googlesitemap/model/googlesitemap/googlesitemap.class.php index 2a935f4..80820e0 100755 --- a/core/components/googlesitemap/model/googlesitemap/googlesitemap.class.php +++ b/core/components/googlesitemap/model/googlesitemap/googlesitemap.class.php @@ -42,6 +42,7 @@ function __construct(modX &$modx,array $config = array()) { $corePath = $this->modx->getOption('googlesitemap.core_path',null,$this->modx->getOption('core_path').'components/googlesitemap/'); $this->config = array_merge(array( 'allowedtemplates' => '', + 'excludeTemplates' => '', 'context' => '', 'googleSchema' => 'http://www.sitemaps.org/schemas/sitemap/0.9', 'hideDeleted' => true, @@ -195,6 +196,15 @@ public function getQuery($currentParent) { 'Template.'.$this->config['templateFilter'].':IN' => $tpls, )); } + + /* if excluding templates */ + if (!empty($this->config['excludeTemplates'])) { + $tpls = $this->prepareForIn($this->config['excludeTemplates']); + $c->innerJoin('modTemplate','Template'); + $c->where(array( + 'Template.'.$this->config['templateFilter'].':NOT IN' => $tpls, + )); + } /* where filtering */ if (!empty($this->config['where'])) {