Browse Source

add support for link target selection (default: _blank)

Fernando Ribeiro 7 years ago
parent
commit
26425d567a
8 changed files with 16 additions and 5 deletions
  1. 2 0
      conf/default.php
  2. 2 0
      conf/metadata.php
  3. 2 1
      lang/en/settings.php
  4. 2 1
      lang/es/settings.php
  5. 2 1
      lang/fr/settings.php
  6. 1 0
      lang/ja/settings.php
  7. 2 1
      lang/pt/settings.php
  8. 3 1
      syntax/button.php

+ 2 - 0
conf/default.php

@@ -12,4 +12,6 @@ $conf['networks']           = 'twitter facebook googleplus linkedin pinterest tu
 
 $conf['display']            = 'color';
 
+$conf['target']             = '_blank';
+
 $conf['twitter_user']       = '';

+ 2 - 0
conf/metadata.php

@@ -12,4 +12,6 @@ $meta['networks']           = array('string', '_pattern' => '/^[a-zA-Z\s]*$/');
 
 $meta['display']            = array('multichoice','_choices' => array('name', 'icon', 'color'));
 
+$meta['target']             = array('multichoice','_choices' => array('_blank', '_self', '_parent', '_top'));
+
 $meta['twitter_user']       = array('string', '_pattern' => '/^[a-zA-Z0-9_]*$/');

+ 2 - 1
lang/en/settings.php

@@ -11,4 +11,5 @@
 $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 stumbleupon xing vk email';
 $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 "@")';
+$lang['target']             = 'Link target: specifies where to open the social network page.';
+$lang['twitter_user']       = 'Twitter username of content author (don\'t include "@").';

+ 2 - 1
lang/es/settings.php

@@ -11,4 +11,5 @@
 $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 stumbleupon xing vk email';
 $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 "@")';
+$lang['target']             = 'Link target: specifies where to open the social network page.';
+$lang['twitter_user']       = 'Nombre de usuario del autor en Twitter (sin incluir la "@").';

+ 2 - 1
lang/fr/settings.php

@@ -11,4 +11,5 @@
 $lang['networks']           = 'Liste des boutons de vos réseaux sociaux préférés, séparés par un espace et dans l\'ordre d\'affichage. Noms acceptés : ';
 $lang['networks']          .= 'twitter facebook googleplus linkedin pinterest tumblr reddit taringa stumbleupon xing vk email';
 $lang['display']            = 'Options d\'affichage : Montrer le bouton avec l\'icône et le nom, uniquement l\'icône ou le nom sur un fond coloré.';
-$lang['twitter_user']       = 'Nom d\'utilisateur du compte Twitter de l\'auteur du contenu (ne pas ajouter "@")';
+$lang['target']             = 'Link target: specifies where to open the social network page.';
+$lang['twitter_user']       = 'Nom d\'utilisateur du compte Twitter de l\'auteur du contenu (ne pas ajouter "@").';

+ 1 - 0
lang/ja/settings.php

@@ -11,4 +11,5 @@
 $lang['networks']           = '表示するボタンを半角スペースで区切り順番に指定します。 指定可能なボタン名は ';
 $lang['networks']          .= 'twitter facebook googleplus linkedin pinterest tumblr reddit taringa stumbleupon xing vk email';
 $lang['display']            = '表示プション: アイコンと名前の両方、アイコンのみ、背景色の上に名前のみから選択';
+$lang['target']             = 'Link target: specifies where to open the social network page.';
 $lang['twitter_user']       = 'Twitterユーザー名("@"は含めない)';

+ 2 - 1
lang/pt/settings.php

@@ -11,4 +11,5 @@
 $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 googleplus linkedin pinterest tumblr reddit taringa stumbleupon xing vk email';
 $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 "@")';
+$lang['target']             = 'Alvo da ligação: especifica onde abrir a página da rede social.';
+$lang['twitter_user']       = 'O nome de utilizador do autor no Twitter (sem incluir o "@").';

+ 3 - 1
syntax/button.php

@@ -119,6 +119,8 @@ class syntax_plugin_socialite_button extends DokuWiki_Syntax_Plugin {
         $title    = rawurlencode(($INFO['meta']['title']) ? $INFO['meta']['title'] : $meta);
         $abstract = rawurlencode($INFO['meta']['description']['abstract']);
 
+        $target = $this->getConf('target') ;
+
         switch ($network) {
             case 'twitter':
                 $name = 'Twitter';
@@ -172,7 +174,7 @@ class syntax_plugin_socialite_button extends DokuWiki_Syntax_Plugin {
         }
 
         $xhtml  = '<li class="' . $display . '">';
-        $xhtml .= '<a class="' . $network . '" href="' . $href . '">' . $name . '</a>';
+        $xhtml .= '<a class="' . $network . '" target="' . $target . '" href="' . $href . '">' . $name . '</a>';
         $xhtml .= '</li>';
 
         return $xhtml;