[ Index ]
 

Code source de Serendipity 1.2

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/plugins/serendipity_plugin_eventwrapper/ -> serendipity_plugin_eventwrapper.php (source)

   1  <?php # $Id: serendipity_plugin_eventwrapper.php 685 2005-11-12 18:19:05Z elf2000 $
   2  
   3  // Probe for a language include with constants. Still include defines later on, if some constants were missing
   4  $probelang = dirname(__FILE__) . '/' . $serendipity['charset'] . 'lang_' . $serendipity['lang'] . '.inc.php';
   5  if (file_exists($probelang)) {
   6      include $probelang;
   7  }
   8  
   9  include dirname(__FILE__) . '/lang_en.inc.php';
  10  
  11  class serendipity_plugin_eventwrapper extends serendipity_plugin
  12  {
  13  var $rewrite_from, $rewrite_to;
  14  
  15      function introspect(&$propbag)
  16      {
  17          global $serendipity;
  18  
  19          $propbag->add('name',          PLUGIN_EVENT_WRAPPER_NAME);
  20          $propbag->add('description',   PLUGIN_EVENT_WRAPPER_DESC);
  21          $propbag->add('stackable',     true);
  22          $propbag->add('author',        'Garvin Hicking');
  23          $propbag->add('version',       '1.0');
  24          $propbag->add('requirements',  array(
  25              'serendipity' => '0.8',
  26              'smarty'      => '2.6.7',
  27              'php'         => '4.1.0'
  28          ));
  29          $propbag->add('groups', array('FRONTEND_FEATURES'));
  30          $propbag->add('configuration', array('event_plugin', 'title'));
  31  
  32      }
  33  
  34      function introspect_config_item($name, &$propbag)
  35      {
  36          global $serendipity;
  37  
  38          switch($name) {
  39              case 'event_plugin':
  40                  $plugins = serendipity_plugin_api::get_event_plugins();
  41                  $select = array();
  42  
  43                  if (is_array($plugins)) {
  44                      foreach($plugins AS $plugname => $plugarray) {
  45                          $select[$plugname] = $plugarray['t'];
  46                      }
  47                  }
  48  
  49                  $propbag->add('type',        'select');
  50                  $propbag->add('name',        PLUGIN_EVENT_WRAPPER_PLUGIN);
  51                  $propbag->add('description', PLUGIN_EVENT_WRAPPER_PLUGINDESC);
  52                  $propbag->add('select_values', $select);
  53                  $propbag->add('default', 'false');
  54                  break;
  55  
  56              case 'title':
  57                  $propbag->add('type',        'string');
  58                  $propbag->add('name',        TITLE);
  59                  $propbag->add('description', PLUGIN_EVENT_WRAPPER_TITLEDESC);
  60                  $propbag->add('default', '');
  61                  break;
  62  
  63              default:
  64                      return false;
  65          }
  66          return true;
  67      }
  68  
  69      function generate_content(&$title)
  70      {
  71          $plug = $this->get_config('event_plugin', 'false');
  72          if ($plug == 'false') {
  73              return;
  74          }
  75  
  76          $wrap = &serendipity_plugin_api::get_event_plugins($plug);
  77          $faketitle = '';
  78          if (is_object($wrap)) {
  79              $wrap->generate_content($faketitle);
  80          }
  81  
  82          if ($this->get_config('title') != '') {
  83              $title = $this->get_config('title');
  84          } else {
  85              $title = $faketitle;
  86          }
  87      }
  88  }
  89  
  90  /* vim: set sts=4 ts=4 expandtab : */
  91  ?>


Généré le : Sat Nov 24 09:00:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics