[Pieforms-commit] SF.net SVN: pieforms: [31] pieforms/src/pieform.php
Status: Alpha
Brought to you by:
oracleshinoda
From: <ora...@us...> - 2006-11-18 13:04:34
|
Revision: 31 http://svn.sourceforge.net/pieforms/?rev=31&view=rev Author: oracleshinoda Date: 2006-11-18 05:04:32 -0800 (Sat, 18 Nov 2006) Log Message: ----------- * If the form method is 'get' and a file upload element is in the form, notify the user * Make sure the is_submitted() method is declared public * Added a method for displaying information, which allows a callback function to override its behaviour Modified Paths: -------------- pieforms/src/pieform.php Modified: pieforms/src/pieform.php =================================================================== --- pieforms/src/pieform.php 2006-11-18 12:52:08 UTC (rev 30) +++ pieforms/src/pieform.php 2006-11-18 13:04:32 UTC (rev 31) @@ -378,6 +378,10 @@ } if ($element['type'] == 'file') { $this->fileupload = true; + if ($this->method == 'get') { + $this->method = 'post'; + self::info("Your form '$this->name' had the method 'get' and also a file element - it has been converted to 'post'"); + } } if ($element['type'] == 'fieldset') { foreach ($element['elements'] as $subname => &$subelement) { @@ -393,6 +397,10 @@ } if ($subelement['type'] == 'file') { $this->fileupload = true; + if ($this->method == 'get') { + $this->method = 'post'; + self::info("Your form '$this->name' had the method 'get' and also a file element - it has been converted to 'post'"); + } } if (!$autofocusadded && $this->autofocus === true) { $subelement['autofocus'] = true; @@ -561,7 +569,7 @@ * * @return bool */ - function is_submitted() { + public function is_submitted() { return $this->submitted; } @@ -1073,6 +1081,19 @@ } /** + * Hook for giving information back to the developer + */ + public static function info($message) { + $function = 'pieform_info'; + if (function_exists($function)) { + $function($message); + } + else { + trigger_error($message, E_USER_NOTICE); + } + } + + /** * Returns elements with errors on them * * @return array An array of elements with errors on them, the empty array This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |