first commit
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
global $wpdb;
|
||||
|
||||
function onair_optionpage () {
|
||||
echo "
|
||||
<div class=\"wrap\">
|
||||
<h2>OnAIR options</h2>";
|
||||
$submit=(!empty($_REQUEST['submit'])) ? $_REQUEST['submit']:'';
|
||||
if (!empty($submit)) {
|
||||
update_onair_options();
|
||||
}
|
||||
onair_option_form ();
|
||||
echo "</div>";
|
||||
}
|
||||
|
||||
function update_onair_options(){
|
||||
$OK = false;
|
||||
|
||||
if ($_REQUEST['onair_showtext']){
|
||||
update_option('onair_showtext',$_REQUEST['onair_showtext']);
|
||||
$OK = true;
|
||||
}
|
||||
if ($_REQUEST['onair_showOn']){
|
||||
update_option('onair_showOn',$_REQUEST['onair_showOn']);
|
||||
$OK = true;
|
||||
}
|
||||
if ($OK){
|
||||
echo "<p>Options seved!</p>";
|
||||
}
|
||||
else {
|
||||
echo "<p>Failed to save options!</p>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function onair_option_form (){
|
||||
echo "
|
||||
<form action=\"".$_SERVER['REQUEST_URI']."\" enctype=\"multipart/form-data\" method=\"post\">
|
||||
<table class=\"form-table\">
|
||||
<tr valign=\"top\">
|
||||
<th scope=\"row\"><label for=\"onair_showtext\">Texte On AIR</label></th>
|
||||
<td><input id=\"onair_showtext\" class=\"regular-text\" name=\"onair_showtext\" type=\"text\" value=\"".get_option( 'onair_showtext' )."\"></td>
|
||||
</tr>
|
||||
<tr valign=\"top\">
|
||||
<th scope=\"row\"><label for=\"onair_showOn\">Show onAIR</label></th>
|
||||
<td>
|
||||
<input name=\"onair_showOn\" type=\"radio\" value=\"true\" ".checked(get_option( 'onair_showOn' ), 'true', false)."/>Yes
|
||||
<input name=\"onair_showOn\" type=\"radio\" value=\"false\" ".checked(get_option( 'onair_showOn' ), 'false', false)."/>No
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class=\"submit\">
|
||||
<input class=\"button-primary\" type=\"submit\" name=\"submit\" value=\"Submit\">
|
||||
</p>
|
||||
</form>
|
||||
";
|
||||
}
|
||||
|
||||
echo onair_optionpage ();
|
||||
?>
|
||||
Reference in New Issue
Block a user