liberty
[ class tree: liberty ] [ index: liberty ] [ all elements ]

Source for file data.translated.php

Documentation is available at data.translated.php

  1. <?php
  2. /**
  3.  * @version  $Revision$
  4.  * @package  liberty
  5.  * @subpackage plugins_data
  6.  */
  7. // +----------------------------------------------------------------------+
  8. // | Copyright (c) 2004, bitweaver.org
  9. // +----------------------------------------------------------------------+
  10. // | All Rights Reserved. See below for details and a complete list of authors.
  11. // | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
  12. // |
  13. // | For comments, please use phpdocu.sourceforge.net documentation standards!!!
  14. // | -> see http://phpdocu.sourceforge.net/
  15. // +----------------------------------------------------------------------+
  16. // | Author (TikiWiki): Mose <mose@users.sourceforge.net>
  17. // | Reworked & Undoubtedly Screwed-Up for (Bitweaver)
  18. // | by: StarRider <starrrider@sourceforge.net>
  19. // | Reworked from: wikiplugin_translated.php - see deprecated code below
  20. // +----------------------------------------------------------------------+
  21. // $Id$
  22.  
  23. /**
  24.  * definitions
  25.  */
  26. define'PLUGIN_GUID_DATATRANSLATED''datatranslated' );
  27. global $gLibertySystem;
  28. $pluginParams array (
  29.     'tag' => 'TRANSLATED',
  30.     'auto_activate' => FALSE,
  31.     'requires_pair' => FALSE,
  32.     'load_function' => 'data_translated',
  33.     'title' => 'Translated - (not yet functional)'// Remove this line when the plugin becomes operational
  34. //    'title' => 'Translated', // and Remove the comment from the start of this line, and the comments Help Function below
  35.     'help_page' => 'DataPluginTranslated',
  36.     'description' => tra("This plugin is used to create a link to a page that contains a translation. The link can be shown as an Icon for the country or as an abreviation for the language."),
  37.     'help_function' => 'data_translated_help',
  38.     'syntax' => "{TRANSLATED page= lang= flag= }",
  39.     'plugin_type' => DATA_PLUGIN
  40. );
  41. $gLibertySystem->registerPluginPLUGIN_GUID_DATATRANSLATED$pluginParams );
  42. $gLibertySystem->registerDataTag$pluginParams['tag']PLUGIN_GUID_DATATRANSLATED );
  43.  
  44. // Help Function
  45. function data_translated_help({
  46.     $back tra("^__Parameter Syntax:__ ""~np~{TRANSLATED" tra("(key=>value)}~/np~\n");
  47.     $back.= tra("||__::key::__ | __::value::__ | __::Comments::__\n");
  48.     $back.= "::page::" tra(" | ::page name:: |  __Manditory__ Is a valid url for the page which contains the translation. The page name can be in the formats [url] or ((wikiname)) or ((inter:interwiki))\n^");
  49.     $back.= "::lang::" tra(" | ::abreviation:: | __Manditory__ Is a 2 letter code that specifies the language to use. See the Abreviations given below.\n");
  50.     $back.= "::flag::" tra(" | ::flag name:: | __Optional__ Is an image file that can be used as the link. See the Flag Names given below\n");
  51. //    $back.= "^__Flag Names:__ ~pp~American_Samoa / Angola / Antigua / Argentina / Armenia / Australia / Austria / Bahamas / Bahrain / Bangladesh / Barbados / Belgium / Bermuda / Bolivia / Brazil / Brunei / Canada / Cayman_Islands / Chile / China / Colombia / Cook_Islands / Costa_Rica / Croatia / Cuba / Cyprus / Czech_Republic / Denmark / Dominican_Republic / Ecuador / Egypt / El_Salvador / Estonia / Federated_States_of_Micronesia / Fiji / Finland / France / French_Polynesia / Germany / Greece / Guam / Guatemala / Haiti / Honduras / Hungary / Iceland / India / Indonesia / Iran / Iraq / Ireland / Israel / Italy / Jamaica / Japan / Jordan / Kazakstan / Kenya / Kiribati / Kuwait / Latvia / Lebanon / Lithuania / Malawi / Malaysia / Malta / Marshall_Islands / Mauritius / Mexico / Morocco / Mozambique / Nauru / Nepal / Netherlands / New_Caledonia / New_Zealand / Nicaragua / Nigeria / Niue / Norway / Pakistan / Panama / Papua_New_Guinea / Paraguay / Peru / Phillippines / Poland / Portugal / Puerto_Rico / Quatar / Romania / Russia / Samoa / Saudi_Arabia / Singapore / Slovakia / Slovenia / Solomon_Islands / Somalia / South_Africa / South_Korea / Spain / Sri_Lanka / St_Vincent_Grenadines / Surinam / Sweden / Switzerland / Taiwan / Thailand / Tonga / Trinidad_Tobago / Turkey / Tuvalu / Ukraine / United_Arab_Emirates / United_Kingdom / United_States / Uruguay / Vanuatu / Venezuela / Wales / Yugoslavia / Zambia / Zimbabwe~/pp~\n^";
  52. //    $back.= tra("^ __Language Abreviations:__ Chinese (Simplified)=") . "__cn__" . tra(" /  Chinese Traditional=") . "__tw__" . tra(" / Czech=") . "__cs__" . tra(" / Danish=") . "__da__" . tra(" / English=") . "__en__" . tra(" / French=") . "__fr__" . tra(" / German=") . "__de__" . tra(" / Hebrew=") . "__he__" . tra(" / Italian=") . "__it__" . tra(" / Japanese=") . "__ja__" . tra(" / Norwegian=") . "__no__" . tra(" / Polish=") . "__po__" . tra(" / Russian=") . "__ru__" . tra(" / Serbian=") . "__sr__" . tra(" / Slovak=") . "__sk__" . tra(" Spanish=") . "__es__" . tra(" Swedish=") . "__sv__.||^";
  53.     $back.= tra("^__Example:__ ""~np~{TRANSLATED(page=>Home Page,lang=>fr,flag=>France)}~/np~^";
  54.     return $back;
  55. }
  56.  
  57. // Load Function
  58. function data_translated($data$params{
  59.     extract ($paramsEXTR_SKIP);
  60.     if (!isset($page) ) {  // A Manditory Parameter is missing
  61.         $ret 'The __page__ parameter was missing from the __~np~{TRANSLATED}~/np~__ plugin.';
  62.         $ret.= data_translated_help();
  63.         return $ret;
  64.     }
  65.     if (!isset($lang) ) {  // A Manditory Parameter is missing
  66.         $ret 'The __lang__ parameter was missing from the __~np~{TRANSLATED}~/np~__ plugin.';
  67.         $ret.= data_translated_help();
  68.         return $ret;
  69.     }
  70.  
  71.     $img '';
  72.     $h opendir(USERS_PKG_PATH "icons/flags/");
  73.     while ($file readdir($h)) // Open the directory and read each filename
  74.         if (substr($file,0,1!= '.' and substr($file,-4,4== '.gif'// Operate only on gif files
  75.             $avflags[substr($file,0,strlen($file)-4);
  76.         }
  77.     }
  78.     if (isset($flag)) {
  79.         if (in_array($flag,$avflags)) {
  80.             $file USERS_PKG_URL "icons/flags/" $flag ".gif";
  81.             $img "<img src='$file' width='18' height='13' vspace='0' hspace='3' alt='($lang)' align='baseline' />";
  82.         }
  83.     else {
  84.         $img "($lang";
  85.     }
  86.     $ret $img $page;
  87.     return $ret;
  88. }
  89. /******************************************************************************
  90. The code below is from the deprecated TRANSLATED plugin. All comments and the help routines have been removed. - StarRider
  91. function wikiplugin_translated($data, $params) {
  92.     extract ($params, EXTR_SKIP);
  93.     $img = '';
  94.     $h = opendir(USERS_PKG_URL . "icons/flags/");
  95.     while ($file = readdir($h)) {
  96.         if (substr($file,0,1) != '.' and substr($file,-4,4) == '.gif') {
  97.             $avflags[] = substr($file,0,strlen($file)-4);
  98.         }
  99.     }
  100.     if (isset($flag)) {
  101.         if (in_array($flag,$avflags)) {
  102.             $img = "<img src=IMG_PKG_URL.'flags/$flag.gif' width='18' height='13' vspace='0' hspace='3' alt='$lang' align='baseline' /> ";
  103.         }
  104.     }
  105.     if (!$img) {
  106.         $img = "( $lang ) ";
  107.     }
  108.     if (isset($data)) {
  109.         $back = $img.$data;
  110.     } else {
  111.         $back = "''no data''";
  112.     }
  113.     return $back;
  114. }
  115. */
  116. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:21 +0000 by phpDocumentor 1.5.0-lsces