diff --git a/action.php b/action.php index 6af699f..b9a0585 100644 --- a/action.php +++ b/action.php @@ -2,7 +2,7 @@ /** * Tag Alerts plugin main file * - * @author: Simon Delage + * @author: Simon Delage * @license: CC Attribution-Share Alike 3.0 Unported */ @@ -53,7 +53,7 @@ class action_plugin_tagalerts extends DokuWiki_Action_Plugin{ global $ACT; if (($this->getConf('action') == "messages") & ($ACT == "show")) { - // Get an array of notification triggers from 'notify' option (make sure the list is well formated: no blanks between triggers and no '_' in triggers) + // Get an array of triggers from settings (make sure the list is well formated: no blanks between triggers and no '_' in triggers) $errorTriggers = explode(',',str_replace('_', ' ', str_replace(', ', ',', $this->getConf('error')))); $infoTriggers = explode(',',str_replace('_', ' ', str_replace(', ', ',', $this->getConf('info')))); $successTriggers = explode(',',str_replace('_', ' ', str_replace(', ', ',', $this->getConf('success')))); @@ -64,16 +64,18 @@ class action_plugin_tagalerts extends DokuWiki_Action_Plugin{ $tagalerts['info'] = array_values((array_intersect($this->pagetags, $infoTriggers))); $tagalerts['success'] = array_values((array_intersect($this->pagetags, $successTriggers))); $tagalerts['notify'] = array_values((array_intersect($this->pagetags, $notifyTriggers))); - foreach($tagalerts as $type=>$tag) { - if (isset($tag[0])) { - // Alert from conf file - if (isset($conf['plugin']['tagalerts']['specAlerts'][$tag[0]])) { - $msg = $conf['plugin']['tagalerts']['specAlerts'][$tag[0]]; - // Or from localized $conf - } else { - $msg = $this->getLang('tagalerts').$tag[0]."."; + foreach($tagalerts as $type=>$tags) { + for ($i = 0; $i < count($tags); $i++) { + if (isset($tags[$i]) { + // Alert from conf file + if (isset($conf['plugin']['tagalerts']['specAlerts'][$tags[$i]])) { + $msg = $conf['plugin']['tagalerts']['specAlerts'][$tags[$i]]; + // Or from localized $conf + } else { + $msg = $this->getLang('tagalerts').$tags[$i]."."; + } + echo '
'.hsc($msg).'
'; } - echo '
'.hsc($msg).'
'; } } } diff --git a/conf/default.php b/conf/default.php index 0cb1786..de34150 100644 --- a/conf/default.php +++ b/conf/default.php @@ -2,12 +2,12 @@ /** * Configuration defaults file for Tag Alert plugin * - * @author: Simon Delage + * @author: Simon Delage * @license: CC Attribution-Share Alike 3.0 Unported */ $conf['action'] = 'inline'; -$conf['error'] = ''; //comma separated list of tags for wich a "tag error" should be thrown -$conf['info'] = ''; //comma separated list of tags for wich a "tag info" should be thrown -$conf['success'] = ''; //comma separated list of tags for wich a "tag success" should be thrown -$conf['notify'] = ''; //comma separated list of tags for wich a "tag notification" should be thrown +$conf['error'] = ''; //comma separated list of tags for wich a "tag error" should be thrown +$conf['info'] = ''; //comma separated list of tags for wich a "tag info" should be thrown +$conf['success'] = ''; //comma separated list of tags for wich a "tag success" should be thrown +$conf['notify'] = ''; //comma separated list of tags for wich a "tag notification" should be thrown diff --git a/conf/metadata.php b/conf/metadata.php index eaa7deb..b27a351 100644 --- a/conf/metadata.php +++ b/conf/metadata.php @@ -2,7 +2,7 @@ /** * Configuration metadata file for Tag Alert plugin * - * @author: Simon Delage + * @author: Simon Delage * @license: CC Attribution-Share Alike 3.0 Unported */ diff --git a/lang/en/lang.php b/lang/en/lang.php index 8f881b2..b66e37a 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -2,7 +2,7 @@ /** * English language file for Tag Alerts plugin * - * @author: Simon Delage + * @author: Simon Delage * @license: CC Attribution-Share Alike 3.0 Unported */ diff --git a/lang/en/settings.php b/lang/en/settings.php index 463940e..0904003 100644 --- a/lang/en/settings.php +++ b/lang/en/settings.php @@ -2,7 +2,7 @@ /** * English settings file for Tag Alerts plugin * - * @author: Simon Delage + * @author: Simon Delage * @license: CC Attribution-Share Alike 3.0 Unported */ diff --git a/lang/fr/lang.php b/lang/fr/lang.php index b5c61c3..7d4bc34 100644 --- a/lang/fr/lang.php +++ b/lang/fr/lang.php @@ -2,7 +2,7 @@ /** * French language file for Tag Alerts plugin * - * @author: Simon Delage + * @author: Simon Delage * @license: CC Attribution-Share Alike 3.0 Unported */ diff --git a/lang/fr/settings.php b/lang/fr/settings.php index 47d722a..6ca331e 100644 --- a/lang/fr/settings.php +++ b/lang/fr/settings.php @@ -2,7 +2,7 @@ /** * French settings file for Tag Alerts plugin * - * @author: Simon Delage + * @author: Simon Delage * @license: CC Attribution-Share Alike 3.0 Unported */ diff --git a/plugin.info.txt b/plugin.info.txt index 0984e57..71cbe29 100644 --- a/plugin.info.txt +++ b/plugin.info.txt @@ -1,7 +1,7 @@ base tagalerts author Simon Delage -email simon.geekitude@gmail.com -date 2018-11-14 +email sdelage@gmail.com +date 2018-11-15 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