bb_languageselect: Ausgegraute flags (ohne Übersetzung) NICHT verlinken. Wie? [Gelöst]

  • topshopper topshoppe...
    Sternenflotten-Admiral
    0 x
    181 Beiträge
    0 Hilfreiche Beiträge
    11. 09. 2012, 10:40

    Hallo,
    ich benutze bb_languageselect, das soweit gut funktioniert.
    Seiten OHNE Übersetzung, werden mit grauen Flaggen dargestellt, gut.

    Dennoch sind sie verlinkt.
    Wie kann ich das unterbinden?
    Ich möchte nur die Flaggen ohne Link, falls die Seite keine Übersetzung hat.

    Wer weiss es? Wie könnte man ein doNotLinkit einbauen?

    Hier der Code:

    1. <?php
    2. /***************************************************************
    3. * Copyright notice
    4. *
    5. * (c) 2006 Bernhard Berger <bernhard.berger@gmail.com>
    6. * All rights reserved
    7. *
    8. * This script is part of the TYPO3 project. The TYPO3 project is
    9. * free software; you can redistribute it and/or modify
    10. * it under the terms of the GNU General Public License as published by
    11. * the Free Software Foundation; either version 2 of the License, or
    12. * (at your option) any later version.
    13. *
    14. * The GNU General Public License can be found at
    15. * http://www.gnu.org/copyleft/gpl.html.
    16. *
    17. * This script is distributed in the hope that it will be useful,
    18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
    19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    20. * GNU General Public License for more details.
    21. *
    22. * This copyright notice MUST APPEAR in all copies of the script!
    23. ***************************************************************/
    24.  
    25. require_once(PATH_tslib.'class.tslib_pibase.php');
    26.  
    27.  
    28. /**
    29.  * Plugin 'BB Language Select' for the 'bb_languageselect' extension.
    30.  *
    31.  * @author Bernhard Berger <bernhard.berger@gmail.com>
    32.  * @package TYPO3
    33.  * @subpackage tx_bblanguageselect
    34.  */
    35. class tx_bblanguageselect_pi1 extends tslib_pibase {
    36. var $prefixId = 'tx_bblanguageselect_pi1'; // Same as class name
    37. var $scriptRelPath = 'pi1/class.tx_bblanguageselect_pi1.php'; // Path to this script relative to the extension dir.
    38. var $extKey = 'bb_languageselect'; // The extension key.
    39. var $pi_checkCHash = TRUE;
    40.  
    41. /**
    42. * At the moment just an Alias for showFlags
    43. *
    44. * @param string $content: The PlugIn content
    45. * @param array $conf: The PlugIn configuration
    46. * @return nothing
    47. */
    48. function main($content,$conf) {
    49. return; // just please do nothing :)
    50. }
    51.  
    52.  
    53. /**
    54. * showFlags returns the HTML-Output for the LanguageMenu
    55. *
    56. * @param string $content: The PlugIn content
    57. * @param array $conf: The PlugIn configuration
    58. * @return string flagMenu
    59. */
    60. function showFlags($content, $conf){
    61.  
    62. ## Getting the translated pagetitles
    63. $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
    64. '*',
    65. 'pages_language_overlay',
    66. 'pid='.intval($GLOBALS['TSFE']->id).$GLOBALS['TSFE']->sys_page->enableFields('pages_language_overlay'),
    67. 'sys_language_uid'
    68. );
    69.  
    70. $langArr = array();
    71. while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
    72. $langArr[$row['sys_language_uid']] = $row['title'];
    73. }
    74.  
    75.  
    76. ## Choosing the Iconset by config
    77. switch($conf['iconset']) {
    78. case 'famfamfam':
    79. $flag_path = 'famfamfam';
    80. $size['x'] = 16;
    81. $size['y'] = 11;
    82. break;
    83. case 'jacorre':
    84. $flag_path = 'jacorre';
    85. $size['x'] = 27;
    86. $size['y'] = 17;
    87. break;
    88. case 't3':
    89. $flag_path = 't3flags';
    90. $size['x'] = 20;
    91. $size['y'] = 12;
    92. break;
    93. default:
    94. $flag_path = 'famfamfam';
    95. $size['x'] = 16;
    96. $size['y'] = 11;
    97. break;
    98. }
    99.  
    100. ## The little red indicator for the active language
    101. if ($conf['pointerImg']) {
    102. $pointerImg = $conf['pointerImg'];
    103. } else {
    104. $pointerImg = t3lib_extMgm::siteRelPath('cms').'tslib/media/icons_misc/content_client.gif';
    105. }
    106.  
    107. $pointer = '<img src="'.$pointerImg.'" align="top" alt="" /> ';
    108.  
    109. $flags = array();
    110. $countries = array();
    111. $countries = $this->getCountries($conf);
    112.  
    113. foreach($countries as $cn => $sys_uid){
    114. $flag_file = t3lib_extMgm::siteRelPath('bb_languageselect').'flags/'.$flag_path.'/'.$cn . ($langArr[$sys_uid] || $sys_uid == 0 || $conf['noDisable'] ? '' : '_d').'.gif';
    115.  
    116. if (file_exists($flag_file)) { ## to prevent from displaying broken images
    117. $flags[] = ($GLOBALS['TSFE']->sys_language_uid == $sys_uid ? $pointer: '').
    118. '<a href="'.htmlspecialchars(
    119. $this->pi_getPageLink(
    120. $GLOBALS['TSFE']->id,
    121. '', array('L' => $sys_uid)
    122. )
    123. ).
    124. '"><img src="'.$flag_file.'" width="'.$size['x'].'" height="'.$size['y'].'" border="0" alt="" /></a>  ';
    125. }
    126. }
    127.  
    128.  
    129. $content = implode('',$flags);
    130. return $this->pi_wrapInBaseClass($content);
    131.  
    132. }
    133.  
    134.  
    135. /**
    136. * Returns an Array of countries, filtered from the config.
    137. *
    138. * @param array $conf plugin-config
    139. * @return array $countries an array just filled with the ISO-3166 country codes
    140. *
    141. * */
    142. function getCountries($conf){
    143. foreach($conf as $k => $v){
    144. if(strpos($k, 'cn_') === false) {
    145. // do nothing
    146. } else {
    147. $countries[strtolower(str_replace('cn_','', $k))] = $v;
    148. }
    149. }
    150. return $countries;
    151. }
    152. }
    153.  
    154.  
    155.  
    156. if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/bb_languageselect/pi1/class.tx_bblanguageselect_pi1.php']) {
    157. include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/bb_languageselect/pi1/class.tx_bblanguageselect_pi1.php']);
    158. }
    159.  
    160. ?>


  • 1
  • topshopper topshoppe...
    Sternenflotten-Admiral
    0 x
    181 Beiträge
    0 Hilfreiche Beiträge
    11. 09. 2012, 12:12

    Wer lange genug sucht, wird auch belohnt:
    Es gibt eine erweiterte Version von Georg Ringer - vielen Dank!

    [url=]http://www.just2b.com/mein-typo3/extensions/bb-languageselect.html[/url]

  • 1