Browse Source

add option to input twitter username

Fernando Ribeiro 9 years ago
parent
commit
bfddff46a6
7 changed files with 22 additions and 14 deletions
  1. 4 2
      conf/default.php
  2. 4 2
      conf/metadata.php
  3. 4 3
      lang/en/settings.php
  4. 4 3
      lang/es/settings.php
  5. 4 3
      lang/pt/settings.php
  6. 1 1
      plugin.info.txt
  7. 1 0
      syntax/button.php

+ 4 - 2
conf/default.php

@@ -8,6 +8,8 @@
 //$conf['fixme']    = 'FIXME';
 
 
-$conf['networks']   = 'twitter facebook googleplus linkedin pinterest tumblr reddit taringa email';
+$conf['networks']       = 'twitter facebook googleplus linkedin pinterest tumblr reddit taringa email';
 
-$conf['display']    = 'color';
+$conf['display']        = 'color';
+
+$conf['twitter_user']   = '';

+ 4 - 2
conf/metadata.php

@@ -8,6 +8,8 @@
 //$meta['fixme'] = array('string');
 
 
-$meta['networks']   = array('string', '_pattern' => '/^[a-zA-Z\s]*$/');
+$meta['networks']       = array('string', '_pattern' => '/^[a-zA-Z\s]*$/');
 
-$meta['display']    = array('multichoice','_choices' => array('name', 'icon', 'color'));
+$meta['display']        = array('multichoice','_choices' => array('name', 'icon', 'color'));
+
+$meta['twitter_user']   = array('string', '_pattern' => '/^[a-zA-Z_]*$/');

+ 4 - 3
lang/en/settings.php

@@ -8,7 +8,8 @@
 // keys need to match the config setting name
 // $lang['fixme'] = 'FIXME';
 
-$lang['networks']   = 'List of your favorite social buttons, space separated and in order of appearance. Valid names are: ';
-$lang['networks']  .= 'twitter facebook googleplus linkedin pinterest tumblr reddit taringa email';
+$lang['networks']       = 'List of your favorite social buttons, space separated and in order of appearance. Valid names are: ';
+$lang['networks']      .= 'twitter facebook googleplus linkedin pinterest tumblr reddit taringa email';
 
-$lang['display']    = 'Display options: show social buttons with icon and name, just the icon or name on backgroud color.';
+$lang['display']        = 'Display options: show social buttons with icon and name, just the icon or name on backgroud color.';
+$lang['twitter_user']   = 'Twitter username of content author (don\'t include "@")';

+ 4 - 3
lang/es/settings.php

@@ -8,7 +8,8 @@
 // keys need to match the config setting name
 // $lang['fixme'] = 'FIXME';
 
-$lang['networks']   = 'Lista de tus butones sociales favoritos, separados por espacio y en orden de aparición. Son nombre válidos: ';
-$lang['networks']  .= 'twitter facebook googleplus linkedin pinterest tumblr reddit taringa email';
+$lang['networks']       = 'Lista de tus butones sociales favoritos, separados por espacio y en orden de aparición. Son nombre válidos: ';
+$lang['networks']      .= 'twitter facebook googleplus linkedin pinterest tumblr reddit taringa email';
 
-$lang['display']    = 'Opciones de visualización: muestra texto o solamente el icono.';
+$lang['display']        = 'Opciones de visualización: muestra texto o solamente el icono.';
+$lang['twitter_user']   = 'Nombre de usuario del autor en Twitter (sin incluir la "@")';

+ 4 - 3
lang/pt/settings.php

@@ -8,7 +8,8 @@
 // keys need to match the config setting name
 // $lang['fixme'] = 'FIXME';
 
-$lang['networks']   = 'A lista dos teus botões sociais favoritos, ordenados e separados por espaços. Os nomes válidos são: ';
-$lang['networks']  .= 'twitter facebook google+ linkedin pinterest tumblr reddit taringa email';
+$lang['networks']       = 'A lista dos teus botões sociais favoritos, ordenados e separados por espaços. Os nomes válidos são: ';
+$lang['networks']      .= 'twitter facebook google+ linkedin pinterest tumblr reddit taringa email';
 
-$lang['display']    = 'Opções de exibição: mostra texto ou apenas o ícone.';
+$lang['display']        = 'Opções de exibição: mostra texto ou apenas o ícone.';
+$lang['twitter_user']   = 'O nome de utilizador do autor no Twitter (sem incluir o "@")';

+ 1 - 1
plugin.info.txt

@@ -4,4 +4,4 @@ email  pinguim.ribeiro@gmail.com
 date   2015-08-21
 name   lsb plugin
 desc   Lightweight social buttons
-url    https://www.dokuwiki.org/plugin:lsb
+url    https://servidordebian.org

+ 1 - 0
syntax/button.php

@@ -136,6 +136,7 @@ class syntax_plugin_lsb_button extends DokuWiki_Syntax_Plugin {
             case 'twitter':
                 $name = 'Twitter';
                 $href = 'https://twitter.com/intent/tweet?url=' . $url . '&text='. $title;
+                if (!empty($this->getConf('twitter_user'))) { $href .= "&via=" . rawurlencode($this->getConf('twitter_user')); }
                 break;
             case 'facebook':
                 $name = 'Facebook';