From 182dcc42117f13ed6661f99d57abe81300ad3c1e Mon Sep 17 00:00:00 2001 From: Simon DELAGE Date: Sat, 9 Feb 2019 06:56:17 +0100 Subject: [PATCH] Fix #1 Had to remove underscores to compare Tagalerts conf to against actual tags but I did not realize I had to re-introduce underscores later on --- action.php | 9 ++++----- plugin.info.txt | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/action.php b/action.php index bcffd89..fae4dc2 100644 --- a/action.php +++ b/action.php @@ -41,7 +41,6 @@ class action_plugin_tagalerts extends DokuWiki_Action_Plugin{ } } // Load special messages from ...tagalerts/conf/tagalerts.conf to global conf -// $specAlertsFile = dirname(__FILE__).'/conf/tagalerts.conf'; $specAlertsFile = DOKU_CONF.'tagalerts.conf'; if (@file_exists($specAlertsFile)) { $conf['plugin']['tagalerts']['specAlerts'] = confToHash($specAlertsFile); @@ -66,10 +65,11 @@ class action_plugin_tagalerts extends DokuWiki_Action_Plugin{ $tagalerts['notify'] = array_values((array_intersect($this->pagetags, $notifyTriggers))); foreach($tagalerts as $type=>$tags) { for ($i = 0; $i < count($tags); $i++) { - if ((isset($tags[$i])) and (($this->getConf('action') == "messages") or (strpos($this->getConf('forcemsg'), $tags[$i]) !== false))) { + $underscored = str_replace(' ', '_', $tags[$i]); + if ((isset($tags[$i])) and (($this->getConf('action') == "messages") or (strpos($this->getConf('forcemsg'), $underscored) !== false))) { // Alert from conf file - if (isset($conf['plugin']['tagalerts']['specAlerts'][$tags[$i]])) { - $msg = $conf['plugin']['tagalerts']['specAlerts'][$tags[$i]]; + if (isset($conf['plugin']['tagalerts']['specAlerts'][$underscored])) { + $msg = $conf['plugin']['tagalerts']['specAlerts'][$underscored]; // Or from localized $conf } else { $msg = $this->getLang('tagalerts').$tags[$i]."."; @@ -119,7 +119,6 @@ class action_plugin_tagalerts extends DokuWiki_Action_Plugin{ // Register the plugin conf file in ConfManager Plugin public function addConfigFile(Doku_Event $event, $params) { if (class_exists('ConfigManagerTwoLine')) { -// $config = new ConfigManagerTwoLine('Tag Alerts', $this->getLang('confdescription'), DOKU_PLUGIN . 'tagalerts/conf/tagalerts.conf'); $config = new ConfigManagerTwoLine('Tag Alerts', $this->getLang('confdescription'), DOKU_CONF . 'tagalerts.conf'); $event->data[] = $config; } diff --git a/plugin.info.txt b/plugin.info.txt index 6fd980a..c54e6ce 100644 --- a/plugin.info.txt +++ b/plugin.info.txt @@ -1,7 +1,7 @@ base tagalerts author Simon Delage email sdelage@gmail.com -date 2018-12-13 +date 2019-02-09 name Tag Alerts desc Throw alerts when some tags are detected (based on Dokuwiki system messages or just styling tag list links) url https://www.dokuwiki.org/plugin:tagalerts