Overview

Packages

  • None
  • Pastie

Classes

  • PasteForm
  • Pastie
  • Pastie_Driver
  • Pastie_Driver_Sql
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Copyright 2010 Alkaloid Networks LLC <http://www.alkaloid.net>
 4:  *
 5:  * See the enclosed file LICENSE for license information (GPL). If you
 6:  * did not receive this file, see http://www.horde.org/licenses/gpl.php.
 7:  *
 8:  * @author Ben Klang <ben@alkaloid.net>
 9:  * @package Pastie
10:  */
11: class PasteForm extends Horde_Form
12: {
13:     /**
14:      */
15:     function PasteForm(&$vars)
16:     {
17:         parent::Horde_Form($vars, _("New Paste"));
18: 
19:         $engine = 'Pastie_Highlighter_' . $GLOBALS['conf']['highlighter']['engine'];
20:         $tmp = call_user_func(array($engine, 'getSyntaxes'));
21:         $types = array();
22:         foreach ($tmp as $type) {
23:             $types[$type] = $type;
24:         }
25: 
26:         // Some highlighters have a long list of supported languages.
27:         // Default to PHP if one is not already specified
28:         $curtype = $vars->get('syntax');
29:         if (empty($curtype)) {
30:             $vars->set('syntax', 'php');
31:         }
32: 
33:         $this->addVariable(_("Title"), 'title', 'text', false);
34: 
35:         $this->addVariable(_("Syntax"), 'syntax', 'enum', true,
36:                    false, null, array($types, false));
37: 
38:         $this->addVariable(_("Paste"), 'paste', 'longtext', true, false, null,
39:                            array('rows' => 20, 'cols' => 100));
40: 
41:         return true;
42:     }
43: }
44: 
API documentation generated by ApiGen