diff --git a/README.md b/README.md index 6885c9c..7cc01a1 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,3 @@ User HomePage Dokuwiki plugin to automatically create user's homepage and/or namespace. Previous authors stopped developing it in 2009. I started to work on it in 2014-08. - -TODO -Add options to select what to include in the string on event and possibly send a FontAwesome string if it is enabled. diff --git a/action.php b/action.php index 52d2cc1..3cc34df 100644 --- a/action.php +++ b/action.php @@ -328,6 +328,10 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{ if (($conf['showuseras'] == "username_link") and ($this->getConf('userlink_replace'))) { $classes = $this->getConf('userlink_classes'); + $classes = str_replace(',', ' ', $classes); + if ($this->getConf('userlink_fa')) { + $classes = str_replace('interwiki', '', $classes); + } $this->username = $event->data['username']; $this->name = $event->data['name']; $this->link = $event->data['link']; @@ -338,11 +342,23 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{ $privateId = $this->helper->getPrivateID(); $publicId = $this->helper->getPublicID(); if ((page_exists($privateId)) && (page_exists($publicId))) { - $return = ''.$INFO['userinfo']['name'].' ('.$_SERVER['REMOTE_USER'].')'; + if ($this->getConf('userlink_fa')) { + $return = ''.$INFO['userinfo']['name'].' ( '.$_SERVER['REMOTE_USER'].')'; + } else { + $return = ''.$INFO['userinfo']['name'].' ('.$_SERVER['REMOTE_USER'].')'; + } } elseif (page_exists($publicId)) { - $return = ''.$INFO['userinfo']['name'].' ('.$_SERVER['REMOTE_USER'].')'; + if ($this->getConf('userlink_fa')) { + $return = ' ( '.$_SERVER['REMOTE_USER'].')'; + } else { + $return = ''.$INFO['userinfo']['name'].' ('.$_SERVER['REMOTE_USER'].')'; + } } elseif (page_exists($privateId)) { - $return = ''.$INFO['userinfo']['name'].' ('.$_SERVER['REMOTE_USER'].')'; + if ($this->getConf('userlink_fa')) { + $return = ''.$INFO['userinfo']['name'].''; + } else { + $return = ''.$INFO['userinfo']['name'].' ('.$_SERVER['REMOTE_USER'].')'; + } } else { $return = null; } diff --git a/conf/default.php b/conf/default.php index 97ba77a..ce21064 100644 --- a/conf/default.php +++ b/conf/default.php @@ -26,3 +26,4 @@ $conf['action'] = 'edit'; $conf['userlink_replace'] = 1; $conf['userlink_classes'] = 'interwiki wikilink1'; + $conf['userlink_fa'] = 0; diff --git a/conf/metadata.php b/conf/metadata.php index 3a5c0c8..92ddd1b 100644 --- a/conf/metadata.php +++ b/conf/metadata.php @@ -26,3 +26,4 @@ $meta['action'] = array('multichoice','_choices'=>array('edit','show')); $meta['userlink_replace'] = array('onoff'); $meta['userlink_classes'] = array('string'); + $meta['userlink_fa'] = array('onoff'); diff --git a/lang/en/settings.php b/lang/en/settings.php index 60d74c1..ec3ba2e 100644 --- a/lang/en/settings.php +++ b/lang/en/settings.php @@ -58,3 +58,4 @@ $lang['action_o_show'] = 'Show'; $lang['userlink_replace'] = 'Enable replacement of [Logged in as] interwiki link, depending on pages created by Userhomepage (only works if showuseras option is set to interwiki link).'; $lang['userlink_classes'] = 'Space separated list of CSS classes to apply to [Logged in as] interwiki links (default: interwiki wikilink1).'; + $lang['userlink_fa'] = 'Use Fontawesome icons instead of images (Fontawesome has to be installed by template or a plugin) ?'; diff --git a/lang/fr/settings.php b/lang/fr/settings.php index 92cb009..f836f8a 100644 --- a/lang/fr/settings.php +++ b/lang/fr/settings.php @@ -58,3 +58,4 @@ $lang['action_o_show'] = 'Afficher'; $lang['userlink_replace'] = 'Activer le remplacement du lien interwiki [Connecté en tant que], selon les pages créées par Userhomepage (ne fonctionne que si l\'option showuseras est configurée pour le lien interwiki).'; $lang['userlink_classes'] = 'Liste séparée par des espaces de classes CSS à appliquer aux liens de la chaîne [Connecté en tant que] (défaut: interwiki wikilink1).'; + $lang['userlink_fa'] = 'Utiliser des icônes Fontawesome au lieu d\'images (Fontawesome doit être installé par le thème ou un plugin) ?'; diff --git a/plugin.info.txt b/plugin.info.txt index 8935cff..103e8ce 100644 --- a/plugin.info.txt +++ b/plugin.info.txt @@ -1,7 +1,7 @@ base userhomepage author Simon Delage email simon.geekitude@gmail.com -date 2015-06-27 +date 2015-07-11 name User Homepage desc Automatically create user's private namespace and/or public page and redirects users to private namespace on login. url https://www.dokuwiki.org/plugin:userhomepage diff --git a/style.css b/style.css index 1e7ae9a..d4a4d05 100644 --- a/style.css +++ b/style.css @@ -5,3 +5,5 @@ Screen Styles for the Userhomepage Plugin (additional to all.css) a.uhp_private,a.uhp_public { padding-left:19px; } a.uhp_private { background:url(images/ns.png) no-repeat left; } a.uhp_public { background:url(images/user.png) no-repeat left; } +a.uhp_fa i.fa-user-secret, +a.uhp_fa i.fa-user { padding: 0 5px 0 2px !important; }