ソースを参照

More sensible detection of empty widget submissions. Still does not address the fact that select lists and checkboxes may not appear in the POST at all when they are empty in the HTML form

pdontthink 17 年 前
コミット
dec6e1f1fa
1 ファイル変更3 行追加3 行削除
  1. 3 3
      functions/options.php

+ 3 - 3
functions/options.php

@@ -210,7 +210,7 @@ class SquirrelOption {
 
 
         /* Check for a new value. */
         /* Check for a new value. */
         if ( !sqgetGlobalVar("new_$name", $this->new_value, SQ_POST ) ) {
         if ( !sqgetGlobalVar("new_$name", $this->new_value, SQ_POST ) ) {
-            $this->new_value = '';
+            $this->new_value = NULL;
         }
         }
 
 
         /* Set the default save function. */
         /* Set the default save function. */
@@ -330,7 +330,7 @@ class SquirrelOption {
         global $color;
         global $color;
 
 
         // Use new value if available
         // Use new value if available
-        if (!empty($this->new_value)) {
+        if (!is_null($this->new_value)) {
             $tempValue = $this->value;
             $tempValue = $this->value;
             $this->value = $this->new_value;
             $this->value = $this->new_value;
         }
         }
@@ -392,7 +392,7 @@ class SquirrelOption {
         $result .= $this->post_script;
         $result .= $this->post_script;
 
 
         // put correct value back if need be
         // put correct value back if need be
-        if (!empty($this->new_value)) {
+        if (!is_null($this->new_value)) {
             $this->value = $tempValue;
             $this->value = $tempValue;
         }
         }