Compare commits
10 commits
3911921b0a
...
10b95ab4b8
Author | SHA1 | Date | |
---|---|---|---|
10b95ab4b8 | |||
adc1f27528 | |||
|
cb61358939 | ||
|
32726b1c07 | ||
|
182dcc4211 | ||
|
76d9e44023 | ||
|
0c23f24502 | ||
|
31ed7cbf59 | ||
|
333cadec5c | ||
|
35e1d042d2 |
10 changed files with 43 additions and 29 deletions
|
@ -1,2 +1,5 @@
|
|||
# dokuwiki-plugin-tagalerts
|
||||
Plugin to highlight specified tags or throw alert messages (requires tag plugin)
|
||||
|
||||
|
||||
All documentation for this plugin can be found [here](http://www.dokuwiki.org/plugin:tagalerts).
|
||||
|
|
34
action.php
34
action.php
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Tag Alerts plugin main file
|
||||
*
|
||||
* @author: Simon Delage <simon.geekitude@gmail.com>
|
||||
* @author Simon DELAGE <sdelage@gmail.com>
|
||||
* @license: CC Attribution-Share Alike 3.0 Unported <http://creativecommons.org/licenses/by-sa/3.0/>
|
||||
*/
|
||||
|
||||
|
@ -35,13 +35,17 @@ class action_plugin_tagalerts extends DokuWiki_Action_Plugin{
|
|||
if(is_null($tags)) true;
|
||||
|
||||
foreach($event->data['meta'] as &$meta) {
|
||||
|
||||
// FIXME: Skip entries where the "name" key is not set,
|
||||
// this might be a symptom of some bug.
|
||||
if ( ! array_key_exists('name', $meta) ) continue;
|
||||
|
||||
if($meta['name'] == 'keywords') {
|
||||
// Get an array of page's tags
|
||||
$this->pagetags = explode(',', $meta['content']);
|
||||
}
|
||||
}
|
||||
// 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);
|
||||
|
@ -52,8 +56,8 @@ class action_plugin_tagalerts extends DokuWiki_Action_Plugin{
|
|||
global $conf;
|
||||
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)
|
||||
if ((($this->getConf('action') == "messages") or ($this->getConf('forcemsg') != null)) & ($ACT == "show")) {
|
||||
// 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 +68,19 @@ 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++) {
|
||||
$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'][$underscored])) {
|
||||
$msg = $conf['plugin']['tagalerts']['specAlerts'][$underscored];
|
||||
// Or from localized $conf
|
||||
} else {
|
||||
$msg = $this->getLang('tagalerts').$tags[$i].".";
|
||||
}
|
||||
echo '<div class="tag'.$type.'">'.hsc($msg).'</div>';
|
||||
}
|
||||
echo '<div class="tag'.$type.'">'.hsc($msg).'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +124,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;
|
||||
}
|
||||
|
|
|
@ -2,12 +2,13 @@
|
|||
/**
|
||||
* Configuration defaults file for Tag Alert plugin
|
||||
*
|
||||
* @author: Simon Delage <simon.geekitude@gmail.com>
|
||||
* @author Simon DELAGE <sdelage@gmail.com>
|
||||
* @license: CC Attribution-Share Alike 3.0 Unported <http://creativecommons.org/licenses/by-sa/3.0/>
|
||||
*/
|
||||
|
||||
$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
|
||||
$conf['forcemsg'] = ''; //comma separated list of tags for wich messages will be forced, even with `inline` setting
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Configuration metadata file for Tag Alert plugin
|
||||
*
|
||||
* @author: Simon Delage <simon.geekitude@gmail.com>
|
||||
* @author Simon DELAGE <sdelage@gmail.com>
|
||||
* @license: CC Attribution-Share Alike 3.0 Unported <http://creativecommons.org/licenses/by-sa/3.0/>
|
||||
*/
|
||||
|
||||
|
@ -11,3 +11,4 @@ $meta['error'] = array('string');
|
|||
$meta['info'] = array('string');
|
||||
$meta['success'] = array('string');
|
||||
$meta['notify'] = array('string');
|
||||
$meta['forcemsg'] = array('string');
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* English language file for Tag Alerts plugin
|
||||
*
|
||||
* @author: Simon Delage <simon.geekitude@gmail.com>
|
||||
* @author Simon DELAGE <sdelage@gmail.com>
|
||||
* @license: CC Attribution-Share Alike 3.0 Unported <http://creativecommons.org/licenses/by-sa/3.0/>
|
||||
*/
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* English settings file for Tag Alerts plugin
|
||||
*
|
||||
* @author: Simon Delage <simon.geekitude@gmail.com>
|
||||
* @author Simon DELAGE <sdelage@gmail.com>
|
||||
* @license: CC Attribution-Share Alike 3.0 Unported <http://creativecommons.org/licenses/by-sa/3.0/>
|
||||
*/
|
||||
|
||||
|
@ -13,3 +13,4 @@ $lang['error'] = 'Comma separated list of tags that will trigge
|
|||
$lang['info'] = 'Comma separated list of tags that will trigger an alert based on system information message.';
|
||||
$lang['success'] = 'Comma separated list of tags that will trigger an alert based on system success message.';
|
||||
$lang['notify'] = 'Comma separated list of tags that will trigger an alert based on system notification message.';
|
||||
$lang['forcemsg'] = 'Comma separated list of tags for wich messages will be forced, even with `inline` setting.';
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* French language file for Tag Alerts plugin
|
||||
*
|
||||
* @author: Simon Delage <simon.geekitude@gmail.com>
|
||||
* @author Simon DELAGE <sdelage@gmail.com>
|
||||
* @license: CC Attribution-Share Alike 3.0 Unported <http://creativecommons.org/licenses/by-sa/3.0/>
|
||||
*/
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* French settings file for Tag Alerts plugin
|
||||
*
|
||||
* @author: Simon Delage <simon.geekitude@gmail.com>
|
||||
* @author Simon DELAGE <sdelage@gmail.com>
|
||||
* @license: CC Attribution-Share Alike 3.0 Unported <http://creativecommons.org/licenses/by-sa/3.0/>
|
||||
*/
|
||||
|
||||
|
@ -11,3 +11,4 @@ $lang['error'] = 'Liste de tags séparés par une virgule qui d
|
|||
$lang['info'] = 'Liste de tags séparés par une virgule qui déclencheront une alerte basée sur les messages système d\'information.';
|
||||
$lang['success'] = 'Liste de tags séparés par une virgule qui déclencheront une alerte basée sur les messages système de succès.';
|
||||
$lang['notify'] = 'Liste de tags séparés par une virgule qui déclencheront une alerte basée sur les messages système de notification..';
|
||||
$lang['forcemsg'] = 'Liste de tags séparés par une virgule pour lesquels une alerte sera déclenchés, même avec l\'option `inline`.';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
base tagalerts
|
||||
author Simon Delage
|
||||
email simon.geekitude@gmail.com
|
||||
date 2018-11-14
|
||||
author Simon Delage, patched by vv221 for Numenaute
|
||||
email numenaute@vv221.fr
|
||||
date 2024-10-04
|
||||
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
|
||||
url https://port.numenaute.org/dokuwiki/dokuwiki-plugin-tagalerts
|
||||
|
|
|
@ -33,8 +33,9 @@
|
|||
.dokuwiki div.tagsuccess,
|
||||
.dokuwiki div.tagnotify {
|
||||
padding: 0 .5em 0 3em;
|
||||
margin: -1.4em auto 1.8em auto;
|
||||
margin: .5em auto .5em 0;
|
||||
background-position: 8px 50%;
|
||||
display: table;
|
||||
}
|
||||
|
||||
.dokuwiki div.tagerror {
|
||||
|
|
Loading…
Reference in a new issue