Compare commits
No commits in common. "10b95ab4b85b33b46ffac291d874522d4d614e37" and "3911921b0ace8eed4420b0a928b149406c2ccf0e" have entirely different histories.
10b95ab4b8
...
3911921b0a
10 changed files with 29 additions and 43 deletions
|
@ -1,5 +1,2 @@
|
|||
# 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 <sdelage@gmail.com>
|
||||
* @author: Simon Delage <simon.geekitude@gmail.com>
|
||||
* @license: CC Attribution-Share Alike 3.0 Unported <http://creativecommons.org/licenses/by-sa/3.0/>
|
||||
*/
|
||||
|
||||
|
@ -35,17 +35,13 @@ 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);
|
||||
|
@ -56,8 +52,8 @@ class action_plugin_tagalerts extends DokuWiki_Action_Plugin{
|
|||
global $conf;
|
||||
global $ACT;
|
||||
|
||||
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)
|
||||
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)
|
||||
$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'))));
|
||||
|
@ -68,19 +64,16 @@ 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=>$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>';
|
||||
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].".";
|
||||
}
|
||||
echo '<div class="tag'.$type.'">'.hsc($msg).'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,6 +117,7 @@ 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,13 +2,12 @@
|
|||
/**
|
||||
* Configuration defaults file for Tag Alert plugin
|
||||
*
|
||||
* @author Simon DELAGE <sdelage@gmail.com>
|
||||
* @author: Simon Delage <simon.geekitude@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['forcemsg'] = ''; //comma separated list of tags for wich messages will be forced, even with `inline` setting
|
||||
$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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Configuration metadata file for Tag Alert plugin
|
||||
*
|
||||
* @author Simon DELAGE <sdelage@gmail.com>
|
||||
* @author: Simon Delage <simon.geekitude@gmail.com>
|
||||
* @license: CC Attribution-Share Alike 3.0 Unported <http://creativecommons.org/licenses/by-sa/3.0/>
|
||||
*/
|
||||
|
||||
|
@ -11,4 +11,3 @@ $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 <sdelage@gmail.com>
|
||||
* @author: Simon Delage <simon.geekitude@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 <sdelage@gmail.com>
|
||||
* @author: Simon Delage <simon.geekitude@gmail.com>
|
||||
* @license: CC Attribution-Share Alike 3.0 Unported <http://creativecommons.org/licenses/by-sa/3.0/>
|
||||
*/
|
||||
|
||||
|
@ -13,4 +13,3 @@ $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 <sdelage@gmail.com>
|
||||
* @author: Simon Delage <simon.geekitude@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 <sdelage@gmail.com>
|
||||
* @author: Simon Delage <simon.geekitude@gmail.com>
|
||||
* @license: CC Attribution-Share Alike 3.0 Unported <http://creativecommons.org/licenses/by-sa/3.0/>
|
||||
*/
|
||||
|
||||
|
@ -11,4 +11,3 @@ $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, patched by vv221 for Numenaute
|
||||
email numenaute@vv221.fr
|
||||
date 2024-10-04
|
||||
author Simon Delage
|
||||
email simon.geekitude@gmail.com
|
||||
date 2018-11-14
|
||||
name Tag Alerts
|
||||
desc Throw alerts when some tags are detected (based on Dokuwiki system messages or just styling tag list links)
|
||||
url https://port.numenaute.org/dokuwiki/dokuwiki-plugin-tagalerts
|
||||
url https://www.dokuwiki.org/plugin:tagalerts
|
||||
|
|
|
@ -33,9 +33,8 @@
|
|||
.dokuwiki div.tagsuccess,
|
||||
.dokuwiki div.tagnotify {
|
||||
padding: 0 .5em 0 3em;
|
||||
margin: .5em auto .5em 0;
|
||||
margin: -1.4em auto 1.8em auto;
|
||||
background-position: 8px 50%;
|
||||
display: table;
|
||||
}
|
||||
|
||||
.dokuwiki div.tagerror {
|
||||
|
|
Loading…
Reference in a new issue