/** * Create a checkbox input field * * Note: In order to obtain a value when the checkbox is unticked * we add a hidden field with a value of off * See http://iamcam.wordpress.com/2008/01/15/unchecked-checkbox-values/ * When the value is set then the checkbox is checked * * @param string $name the name for the checkbox input field * @param string $value the value of the checkbox - default NOT checked * @param bool whether or not the checkbox should be disabled. default: false */ function icheckbox($name, $value = NULL, $disabled = false) { $it = ihidden($name, "0"); $it .= "<input type=\"checkbox\" "; $it .= "name=\""; $it .= $name; $it .= "\" id=\""; $it .= $name; $it .= '"'; if ($value && $value != "0") { $it .= " checked=\"checked\""; } if ($disabled) { $it .= kv("disabled", "disabled"); } $it .= "/>"; return $it; }
/** * Display the edit settings form */ function oik_plugins_edit_settings() { global $bw_plugin; bw_form(); stag("table", "wide-fat"); bw_tablerow(array("plugin", $bw_plugin['plugin'] . ihidden('plugin', $bw_plugin['plugin']))); bw_textfield("server", 100, "server", stripslashes($bw_plugin['server'])); bw_textfield("apikey", 26, "apikey?", $bw_plugin["apikey"]); etag("table"); p(isubmit("_oik_plugins_edit_settings", "Change plugin", null, "button-primary")); etag("form"); }