Datei: plugins/example.userprefs.php

Quellcode
Darstellung:
  1. <?php
  2. /**
  3.  * Plugin example: User preferences
  4.  *
  5.  */
  6. class UserPrefsExample extends BMPlugin 
  7. {
  8.    function UserPrefsExample()
  9.    {
  10.       $this->name             'User preferences 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.0.0';
  16.       $this->type             BMPLUGIN_DEFAULT;
  17.    }
  18.    
  19.    function OnReadLang(&$lang_user, &$lang_client, &$lang_custom, &$lang_admin$lang)
  20.    {
  21.       $lang_user['userprefs_example'] = 'User preferences example';
  22.       $lang_user['prefs_d_userprefs_example'] = 'Show the user preferences example plugin\'s preferences page.';
  23.    }
  24.  
  25.    function FileHandler($file$action)
  26.    {
  27.       if($file=='prefs.php')
  28.       {
  29.          $GLOBALS['prefsItems']['userprefs_example'] = true;
  30.          $GLOBALS['prefsImages']['userprefs_example'] = 'plugins/templates/images/userprefs_ico48.png';
  31.          $GLOBALS['prefsIcons']['userprefs_example'] = 'plugins/templates/images/userprefs_ico16.png';
  32.       }
  33.    }
  34.    
  35.    function UserPrefsPageHandler($action)
  36.    {
  37.       global $tpl;
  38.       
  39.       if($action != 'userprefs_example')
  40.          return(false);
  41.       
  42.       $tpl->assign('pageContent'$this->_templatePath('userprefs.prefspage.tpl'));
  43.       $tpl->display('li/index.tpl');
  44.       return(true);
  45.    }
  46. }
  47.  
  48. /**
  49.  * register plugin
  50.  */
  51. $plugins->registerPlugin('UserPrefsExample');
  52. ?>