b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (0.9.x) [ class tree: plugins ] [ index: plugins ] [ all elements ]

Source for file plugin.class.php

Documentation is available at plugin.class.php

  1. <?php
  2. /**
  3.  * This file implements the Plugin class (EXPERIMENTAL)
  4.  *
  5.  * This is the base class from which all plugins classes are derived.
  6.  *
  7.  * b2evolution - {@link http://b2evolution.net/}
  8.  * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
  9.  * @copyright (c)2003-2005 by Francois PLANQUE - {@link http://fplanque.net/}
  10.  *
  11.  * @package plugins
  12.  */
  13. if!defined('DB_USER') ) die'Please, do not access this page directly.' );
  14.  
  15. /**
  16.  * Plugin Class
  17.  *
  18.  * @package plugins
  19.  * @abstract
  20.  */
  21. class Plugin
  22. {
  23.     /**#@+
  24.      * Should be overriden by derived class:
  25.      */
  26.     var $code = '';
  27.     var $priority = 50;
  28.     var $name = 'Unnamed plug-in';
  29.     var $version;
  30.     var $author;
  31.     var $help_url;
  32.     var $short_desc;
  33.     var $long_desc;
  34.  
  35.     /**#@-*/
  36.  
  37.     /**
  38.      * Constructor, should set name and description
  39.      *
  40.      * {@internal Plugin::Plugin(-) }}
  41.      */
  42.     function Plugin()
  43.     {
  44.         $this->short_desc = T_('No desc available');
  45.         $this->long_desc = T_('No description available');
  46.     }
  47.  
  48.  
  49.     /**
  50.      * Template function: display plugin code
  51.      *
  52.      * {@internal Plugin::code(-) }}
  53.      */
  54.     function code()
  55.     {
  56.         echo $this->code;
  57.     }
  58.  
  59.  
  60.     /**
  61.      * Template function: display plugin name
  62.      *
  63.      * {@internal Plugin::name(-) }}
  64.      *
  65.      * @param string Output format, see {@link format_to_output()}
  66.      */
  67.     function name$format 'htmlbody' )
  68.     {
  69.         echo format_to_output$this->name$format );
  70.     }
  71.  
  72.  
  73.     /**
  74.      * Template function: display short description for plug in
  75.      *
  76.      * {@internal Plugin::short_desc(-) }}
  77.      *
  78.      * @param string Output format, see {@link format_to_output()}
  79.      */
  80.     function short_desc$format 'htmlbody' )
  81.     {
  82.         echo format_to_output$this->short_desc$format );
  83.     }
  84.  
  85.  
  86.     /**
  87.      * Template function: display long description for plug in
  88.      *
  89.      * {@internal Plugin::long_desc(-) }}
  90.      *
  91.      * @param string Output format, see {@link format_to_output()}
  92.      */
  93.     function long_desc$format 'htmlbody' )
  94.     {
  95.         echo format_to_output$this->long_desc$format );
  96.     }
  97.  
  98.  
  99.     /**
  100.      * Set param value
  101.      *
  102.      * {@internal Plugin::set_param(-) }}
  103.      *
  104.      * @param string Name of parameter
  105.      * @param mixed Value of parameter
  106.      */
  107.     function set_param$parname$parvalue )
  108.     {
  109.         // Set value:
  110.         $this->$parname $parvalue;
  111.     }
  112.  
  113. }
  114. ?>

Documentation generated on Tue, 20 May 2008 01:51:55 +0200 by phpDocumentor 1.4.2