Prechádzať zdrojové kódy

Plugin: text fields should not exceed 255 chars #4575

Laurent Opprecht 13 rokov pred
rodič
commit
f3aef674ae
1 zmenil súbory, kde vykonal 10 pridanie a 4 odobranie
  1. 10 4
      main/inc/lib/plugin.class.php

+ 10 - 4
main/inc/lib/plugin.class.php

@@ -1,7 +1,7 @@
 <?php
 
 /**
- * Base class for plugins
+ * Base class for plugins.
  *
  * @copyright (c) 2012 University of Geneva
  * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
@@ -14,11 +14,11 @@ class Plugin
     protected $author = '';
     protected $fields = array();
 
-    protected function __construct($version, $author, $settings = array())
+    protected function __construct($version, $author, $fields = array())
     {
         $this->version = $version;
-        $this->author = $author;
-        $this->fields = $settings;
+        $this->author = $author;      
+        $this->fields = $fields;
 
         global $language_files;
         $language_files[] = 'plugin_' . $this->get_name();
@@ -105,6 +105,12 @@ class Plugin
             {
                 $result->add_html_editor($name, $this->get_lang($name));
             }
+            else if ($type == 'text')
+            {
+                $a = array('maxlength' => 255);
+                $result->addElement($type, $name, $this->get_lang($name), $a);
+                $result->addRule($name, '', 'maxlength', 255);
+            }
             else
             {
                 $result->addElement($type, $name, $this->get_lang($name));