[ Index ]
 

Code source de Serendipity 1.2

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

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

   1  <?php # $Id: serendipity_plugin_templatedropdown.php 1404 2006-08-21 14:34:24Z garvinhicking $
   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_templatedropdown extends serendipity_plugin {
  12      var $title = PLUGIN_TEMPLATEDROPDOWN_NAME;
  13  
  14      function introspect(&$propbag)
  15      {
  16          $this->title = $this->get_config('title', $this->title);
  17  
  18          $propbag->add('name',          PLUGIN_TEMPLATEDROPDOWN_NAME);
  19          $propbag->add('description',   PLUGIN_TEMPLATEDROPDOWN_DESC);
  20          $propbag->add('stackable',     false);
  21          $propbag->add('author',        'Evan Nemerson');
  22          $propbag->add('version',       '1.2');
  23          $propbag->add('requirements',  array(
  24              'serendipity' => '0.8',
  25              'smarty'      => '2.6.7',
  26              'php'         => '4.1.0'
  27          ));
  28          $propbag->add('configuration', array('title', 'show_submit'));
  29          $propbag->add('groups', array('FRONTEND_VIEWS'));
  30  
  31          // Register (multiple) dependencies. KEY is the name of the depending plugin. VALUE is a mode of either 'remove' or 'keep'.
  32          // If the mode 'remove' is set, removing the plugin results in a removal of the depending plugin. 'Keep' meens to
  33          // not touch the depending plugin.
  34          $this->dependencies = array('serendipity_event_templatechooser' => 'remove');
  35      }
  36  
  37      function introspect_config_item($name, &$propbag)
  38      {
  39          switch($name) {
  40              case 'title':
  41                  $propbag->add('type',        'string');
  42                  $propbag->add('name',        TITLE);
  43                  $propbag->add('description', TITLE);
  44                  $propbag->add('default',     '');
  45                  break;
  46  
  47              case 'show_submit':
  48                  $propbag->add('type',        'boolean');
  49                  $propbag->add('name',        PLUGIN_TEMPLATEDROPDOWN_SUBMIT);
  50                  $propbag->add('description', PLUGIN_TEMPLATEDROPDOWN_SUBMIT_DESC);
  51                  $propbag->add('default',     'false');
  52                  break;
  53  
  54              default:
  55                      return false;
  56          }
  57          return true;
  58      }
  59  
  60      function generate_content(&$title) {
  61          global $serendipity;
  62  
  63          $title = $this->get_config('title', $this->title);
  64  
  65          $url = serendipity_currentURL(true);
  66  
  67          echo '<form id="theme_chooser" action="' . $url . '" method="post">';
  68          echo '<select name="user_template" onchange="document.getElementById(\'theme_chooser\').submit();">';
  69          foreach (serendipity_fetchTemplates() as $template) {
  70              $templateInfo = serendipity_fetchTemplateInfo($template);
  71              echo '<option value="' . $template . '" ' . (serendipity_get_config_var('template', 'default') == $template ? 'selected="selected"' : '') . '>' . substr($templateInfo['name'], 0, 25) . '</option>';
  72          }
  73          echo '</select>';
  74  
  75          if ($this->get_config('show_submit', 'false') == 'true') {
  76              echo '<input type="submit" name="submit" value="' . GO . '" size="4" />';
  77          }
  78          echo '</form>';
  79      }
  80  }
  81  
  82  /* vim: set sts=4 ts=4 expandtab : */
  83  ?>


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