Datei: plugins/example.encoding.php

Quellcode
Darstellung:
  1. <?php
  2. /**
  3.  * Plugin example: Encoding conversion
  4.  *
  5.  */
  6. class EncodingExample extends BMPlugin
  7. {
  8.    function EncodingExample()
  9.    {
  10.       $this->name             'Encoding conversion example';
  11.       $this->author           'B1G Software';
  12.       $this->web              'http://www.b1g.de';
  13.       $this->mail             'info@b1g.de';
  14.       $this->version          '1.0';
  15.       $this->designedfor         '7.2.0';
  16.       $this->type             BMPLUGIN_DEFAULT;
  17.  
  18.       $this->admin_pages         true;
  19.       $this->admin_page_title    'Encoding example';
  20.    }
  21.  
  22.    function OnReadLang(&$lang_user, &$lang_client, &$lang_custom, &$lang_admin$lang)
  23.    {
  24.       $_lang_admin = array(
  25.          'encex_test1'     => 'Umlaute: äöü ÄÖÜ',
  26.          'encex_test2'     => 'Noch ein Test: 12,34 €'
  27.       );
  28.  
  29.       // convert charset
  30.       global $currentCharset;
  31.       $arrays = array('admin''client''user''custom');
  32.       foreach($arrays as $array)
  33.       {
  34.          $destArray sprintf('lang_%s'$array);
  35.          $srcArray  '_' $destArray;
  36.  
  37.          if(!isset($$srcArray))
  38.             continue;
  39.  
  40.          foreach($$srcArray as $key=>$val)
  41.          {
  42.            if(function_exists('CharsetDecode') && !in_array(strtolower($currentCharset), array('iso-8859-1''iso-8859-15')))
  43.              $val CharsetDecode($val'iso-8859-15');
  44.            ${$destArray}[$key] = $val;
  45.          }
  46.       }
  47.    }
  48.  
  49.    function AdminHandler()
  50.    {
  51.       global $tpl;
  52.  
  53.       $tabs = array(
  54.          0 => array(
  55.             'title'     => 'Encoding conversion example',
  56.             'link'      => $this->_adminLink() . '&',
  57.             'active' => true
  58.          )
  59.       );
  60.  
  61.       $tpl->assign('tabs'$tabs);
  62.       $tpl->assign('page'$this->_templatePath('encex.admin.tpl'));
  63.    }
  64. }
  65.  
  66. /**
  67.  * register plugin
  68.  */
  69. $plugins->registerPlugin('EncodingExample');
  70. ?>