| 1 |
<?php |
| 2 |
/* This file is part of the wp-forecast plugin for wordpress */ |
| 3 |
|
| 4 |
/* Copyright 2010-2011 Hans Matzen |
| 5 |
|
| 6 |
This program is free software; you can redistribute it and/or modify |
| 7 |
it under the terms of the GNU General Public License as published by |
| 8 |
the Free Software Foundation; either version 2 of the License, or |
| 9 |
(at your option) any later version. |
| 10 |
|
| 11 |
This program is distributed in the hope that it will be useful, |
| 12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
GNU General Public License for more details. |
| 15 |
|
| 16 |
You should have received a copy of the GNU General Public License |
| 17 |
along with this program; if not, write to the Free Software |
| 18 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 |
*/ |
| 20 |
|
| 21 |
|
| 22 |
// generic functions |
| 23 |
require_once("funclib.php"); |
| 24 |
|
| 25 |
|
| 26 |
// |
| 27 |
// add menuitem for options menu |
| 28 |
// |
| 29 |
function wpmu_forecast_admin() |
| 30 |
{ |
| 31 |
pdebug(1,"Start of wpmu_forecast_admin ()"); |
| 32 |
|
| 33 |
$cssurl = WP_PLUGIN_URL . '/wp-forecast/wpf_sa_admin.css'; |
| 34 |
$cssfile = WP_PLUGIN_DIR . '/wp-forecast/wpf_sa_admin.css'; |
| 35 |
if ( file_exists($cssfile) ) { |
| 36 |
wp_register_style('wpf_sa_admin', $cssurl); |
| 37 |
wp_enqueue_style( 'wpf_sa_admin'); |
| 38 |
} |
| 39 |
|
| 40 |
// check if we are superadmin and may see the super admin dialog |
| 41 |
if ( function_exists("is_multisite") && is_multisite() && is_super_admin() ) |
| 42 |
add_submenu_page("options-general.php", 'wp-forecast', 'wp-forecast', 'edit_plugins', |
| 43 |
basename(__FILE__), 'wpf_wpmu_admin_form', |
| 44 |
site_url("/wp-content/wp-forecast").'/wpf_sa.png'); |
| 45 |
|
| 46 |
pdebug(1,"End of wpmu_forecast_admin ()"); |
| 47 |
} |
| 48 |
|
| 49 |
// |
| 50 |
// form handler for the widgets |
| 51 |
// |
| 52 |
function wpf_wpmu_admin_form($wpfcid='A',$widgetcall=0) |
| 53 |
{ |
| 54 |
pdebug(1,"Start of wpf_wpmu_admin_form ()"); |
| 55 |
|
| 56 |
// check for wp-forecast |
| 57 |
$all_plugins = get_plugins(); |
| 58 |
$found = false; |
| 59 |
foreach ( (array)$all_plugins as $plugin_file => $plugin_data) { |
| 60 |
if ( $plugin_data['Name'] == "wp-forecast" && is_plugin_active($plugin_file) ) |
| 61 |
$found = true; |
| 62 |
} |
| 63 |
if ( ! is_plugin_active("wp-forecast/wp-forecast.php") ) |
| 64 |
$out .= '<div class="error"><p>'.__("wp-forecast plugin not found. Please install and activate wp-forecast.").'</p></div>'; |
| 65 |
|
| 66 |
|
| 67 |
// if this is a post call delete_sa_opts |
| 68 |
if ( isset( $_POST['del_sa_opts'] ) && $_POST['delete_sa_opts']==1 ) { |
| 69 |
delete_option("wpf_sa_defaults"); |
| 70 |
delete_option("wpf_sa_allowed"); |
| 71 |
} |
| 72 |
|
| 73 |
// get opts |
| 74 |
$defaults = maybe_unserialize(get_option("wpf_sa_defaults")); |
| 75 |
$allowed = maybe_unserialize(get_option("wpf_sa_allowed")); |
| 76 |
if ($defaults == "") $defaults=array(); |
| 77 |
if ($allowed == "") $allowed=array(); |
| 78 |
|
| 79 |
extract($allowed); |
| 80 |
extract($defaults); |
| 81 |
|
| 82 |
$av=$defaults; |
| 83 |
|
| 84 |
// get locale |
| 85 |
$locale = get_locale(); |
| 86 |
if ( empty($locale) ) |
| 87 |
$locale = 'en_US'; |
| 88 |
|
| 89 |
// load translation |
| 90 |
if(function_exists('load_textdomain')) |
| 91 |
load_textdomain("wp-forecast_".$locale, ABSPATH . PLUGINDIR ."/wp-forecast/lang/".$locale.".mo"); |
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
// if this is a post call |
| 96 |
if ( isset($_POST['info_update']) ) { |
| 97 |
$allowed['ue_wp-forecast-count'] = $_POST['ue_wp-forecast-count']; |
| 98 |
$allowed['ue_wp-forecast-timeout'] = $_POST['ue_wp-forecast-timeout']; |
| 99 |
$allowed['ue_wp-forecast-pre-transport'] = $_POST['ue_wp-forecast-pre-transport']; |
| 100 |
$allowed['ue_wp-forecast-delopt'] = $_POST['ue_wp-forecast-delopt']; |
| 101 |
|
| 102 |
$allowed['ue_service'] = $_POST['ue_service']; |
| 103 |
$allowed['ue_apikey1'] = $_POST['ue_apikey1']; |
| 104 |
$allowed['ue_location'] = $_POST['ue_location']; |
| 105 |
$allowed['ue_locname'] = $_POST['ue_locname']; |
| 106 |
$allowed['ue_refresh'] = $_POST['ue_refresh']; |
| 107 |
$allowed['ue_metric'] = $_POST['ue_metric']; |
| 108 |
$allowed['ue_currtime'] = $_POST['ue_currtime']; |
| 109 |
$allowed['ue_timeoffset'] = $_POST['ue_currtime']; |
| 110 |
$allowed['ue_windunit'] = $_POST['ue_windunit']; |
| 111 |
$allowed['ue_wpf_language'] = $_POST['ue_wpf_language']; |
| 112 |
$allowed['ue_pdforecast'] = $_POST['ue_pdforecast']; |
| 113 |
$allowed['ue_pdfirstday'] = $_POST['ue_pdfirstday']; |
| 114 |
$allowed['ue_dispconfig'] = $_POST['ue_dispconfig']; |
| 115 |
$allowed['ue_forecast'] = $_POST['ue_forecast']; |
| 116 |
if ( $allowed['ue_forecast'] == '1' ) { |
| 117 |
$allowed['ue_daytime']='1'; |
| 118 |
$allowed['ue_nighttime']='1'; |
| 119 |
} else { |
| 120 |
$allowed['ue_daytime']=''; |
| 121 |
$allowed['ue_nighttime']=''; |
| 122 |
} |
| 123 |
|
| 124 |
$defaults['wp-forecast-count'] = $_POST['wp-forecast-count']; |
| 125 |
$defaults['wp-forecast-timeout'] = $_POST['wp-forecast-timeout']; |
| 126 |
$defaults['wp-forecast-pre-transport'] = $_POST['wp-forecast-pre-transport']; |
| 127 |
$defaults['wp-forecast-delopt']= $_POST['wp-forecast-delopt']; |
| 128 |
|
| 129 |
$defaults['service'] = $_POST['service']; |
| 130 |
$defaults['location'] = $_POST['location']; |
| 131 |
$defaults['locname'] = $_POST['locname']; |
| 132 |
$defaults['refresh'] = $_POST['refresh']; |
| 133 |
$defaults['apikey1'] = $_POST['apikey1']; |
| 134 |
$defaults['metric'] = $_POST['metric']; |
| 135 |
$defaults['currtime'] = $_POST['currtime']; |
| 136 |
$defaults['timeoffset'] = $_POST['timeoffset']; |
| 137 |
$defaults['windunit'] = $_POST['windunit']; |
| 138 |
$defaults['wpf_language'] = $_POST['wpf_language']; |
| 139 |
$defaults['pdforecast'] = $_POST['pdforecast']; |
| 140 |
$defaults['pdfirstday'] = $_POST['pdfirstday']; |
| 141 |
|
| 142 |
|
| 143 |
// set empty checkboxes to 0 |
| 144 |
$do = array('d_c_icon','d_c_time','d_c_short','d_c_temp','d_c_real','d_c_press', |
| 145 |
'd_c_humid','d_c_wind','d_c_sunrise','d_c_sunset','d_d_icon','d_d_short', |
| 146 |
'd_d_temp','d_d_wind','d_n_icon','d_n_short','d_n_temp','d_n_wind','d_c_date', |
| 147 |
'd_d_date','d_n_date','d_c_copyright','d_c_wgusts','d_d_wgusts','d_n_wgusts', |
| 148 |
'd_c_accuweather','d_c_aw_newwindow'); |
| 149 |
|
| 150 |
foreach ($do as $i) { |
| 151 |
if ($_POST[$i]=="") |
| 152 |
$_POST["$i"]="0"; |
| 153 |
} |
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
// build config string for dispconfig and update if necessary |
| 158 |
$newdispconfig=""; |
| 159 |
foreach ($do as $i) |
| 160 |
$newdispconfig.=$_POST[$i]; |
| 161 |
|
| 162 |
$defaults['dispconfig'] = $newdispconfig; |
| 163 |
|
| 164 |
// for forecast options |
| 165 |
$nd = array('day1','day2','day3','day4','day5','day6','day7','day8','day9', |
| 166 |
'night1','night2','night3','night4','night5','night6','night7','night8','night9'); |
| 167 |
foreach ($nd as $i) { |
| 168 |
if ($_POST[$i]=="") |
| 169 |
$_POST["$i"]="0"; |
| 170 |
} |
| 171 |
|
| 172 |
|
| 173 |
// build config string for forecast and update if necessary |
| 174 |
$newdaytime=$_POST["day1"].$_POST["day2"].$_POST["day3"].$_POST["day4"].$_POST["day5"].$_POST["day6"]. |
| 175 |
$_POST["day7"].$_POST["day8"].$_POST["day9"]; |
| 176 |
|
| 177 |
$defaults['daytime'] = $newdaytime; |
| 178 |
|
| 179 |
// build config string for forecast and update if necessary |
| 180 |
$newnighttime=$_POST["night1"].$_POST["night2"].$_POST["night3"].$_POST["night4"].$_POST["night5"]. |
| 181 |
$_POST["night6"].$_POST["night7"].$_POST["night8"].$_POST["night9"]; |
| 182 |
|
| 183 |
$defaults['nighttime'] = $newnighttime; |
| 184 |
|
| 185 |
// put message after update |
| 186 |
echo"<div class='updated'><p><strong>"; |
| 187 |
update_option("wpf_sa_defaults",serialize($defaults)); |
| 188 |
update_option("wpf_sa_allowed",serialize($allowed)); |
| 189 |
extract($allowed); |
| 190 |
extract($defaults); |
| 191 |
$av=$defaults; |
| 192 |
echo __('Settings successfully updated',"wp-forecast_".$locale); |
| 193 |
echo "</strong></p></div>"; |
| 194 |
} |
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
// --- form starts here ---------------------------------------------------------------------- |
| 199 |
|
| 200 |
// print out number of widgets selection |
| 201 |
$out = ""; |
| 202 |
$out .= "<div class='wrap'>"; |
| 203 |
$out .= "<h2>WPMU-Admin-Settings for WP-Forecast</h2>"; |
| 204 |
|
| 205 |
$out .= "<span class='wpfbcg'><b>" . __("Check the colored checkboxes to user enable the options","wp-forecast_".$locale) . "</b></span>"; |
| 206 |
$out .= "<form name='options' id='options' method='post' action=''>"; |
| 207 |
|
| 208 |
$out .= "<table><tr><td><span class='wpfbcg'><input type='checkbox' name='ue_wp-forecast-count' value='1'"; |
| 209 |
if ($allowed['ue_wp-forecast-count']=="1") $out .= "checked='checked'"; |
| 210 |
$out .= "/></span>".__('Maximal number of widgets per user',"wp-forecast_".$locale)."</td>"; |
| 211 |
$out .= "<td><input id='wp-forecast-count' name='wp-forecast-count' type='text' size='2' maxlength='2' value='".$defaults['wp-forecast-count']. "' /></td></tr>"; |
| 212 |
|
| 213 |
|
| 214 |
// print out timeout input field for transport |
| 215 |
// (timeout for data connection) |
| 216 |
$out .= "<tr><td><span class='wpfbcg'><input type='checkbox' name='ue_wp-forecast-timeout' value='1'"; |
| 217 |
if ($allowed['ue_wp-forecast-timeout'] == "1") $out .= "checked='checked'"; |
| 218 |
$out .= "/></span>".__('Timeout for weatherprovider connections (secs.)?',"wp-forecast_".$locale)."</td>"; |
| 219 |
$out .= "<td><input id='wp-forecast-timeout' name='wp-forecast-timeout' type='text' size='3' maxlength='3' value='".$defaults['wp-forecast-timeout']. "' />"; |
| 220 |
$out .= "</td></tr>"; |
| 221 |
|
| 222 |
|
| 223 |
// show transport method selection |
| 224 |
$out .= "<tr><td><span class='wpfbcg'><input type='checkbox' name='ue_wp-forecast-pre-transport' value='1'"; |
| 225 |
if ($allowed['ue_wp-forecast-pre-transport'] == "1") $out .= "checked='checked'"; |
| 226 |
$out .= "/></span>".__('Preselect wordpress transfer method',"wp-forecast_".$locale)." :</td>"; |
| 227 |
$out .= "<td><select name='wp-forecast-pre-transport' id='wp-forecast-pre-transport' size='1' >"; |
| 228 |
$out .= "<option value='default'>". __("default","wp-forecast".$locale)."</option>"; |
| 229 |
|
| 230 |
// get wordpress default transports |
| 231 |
$tlist = get_wp_transports(); |
| 232 |
foreach($tlist as $t) |
| 233 |
{ |
| 234 |
$out .= "<option value='$t'" . ($t == $defaults['wp-forecast-pre-transport'] ? 'selected="selected"':'') . ">$t</option>"; |
| 235 |
} |
| 236 |
$out .= "</select></td></tr>"; |
| 237 |
|
| 238 |
// print out option deletion switch |
| 239 |
$out .= "<tr><td ><span class='wpfbcg'><input type='checkbox' name='ue_wp-forecast-delopt' value='1'"; |
| 240 |
if ($allowed['ue_wp-forecast-delopt'] == "1") $out .= "checked='checked'"; |
| 241 |
$out .= "/></span>".__('Delete options during plugin deactivation?',"wp-forecast_".$locale)."</td>"; |
| 242 |
$out .= "<td><input id='wp-forecast-delopt' name='wp-forecast-delopt' type='checkbox' "; |
| 243 |
if ($defaults['wp-forecast-delopt']) |
| 244 |
$out .= 'checked="checked"'; |
| 245 |
$out .= " />"; |
| 246 |
$out .= "</td></tr></table>\n"; |
| 247 |
|
| 248 |
// button to delete superadmin options |
| 249 |
$out .= '<div style="text-align:right;"><label for="delete_sa_opts">'.__('Delete SuperAdmin options',"wp-forecast_".$locale).':</label><input name="delete_sa_opts" id="delete_sa_opts" type="checkbox" value="1" />'; |
| 250 |
$out .= ' <input type="submit" name="del_sa_opts" value="'.__('Delete SA-Options','wp-forecast_'.$locale).' »" /></div>'."\n"; |
| 251 |
|
| 252 |
|
| 253 |
echo $out; |
| 254 |
?> |
| 255 |
<div class="wrap"> |
| 256 |
<!-- add javascript for field control --> |
| 257 |
<?php include("wpf_sa_js.php"); ?> |
| 258 |
<input name='wid' type='hidden' value='<?php echo $wpfcid; ?>'/> |
| 259 |
<h2><?php echo __('Widget-Setup',"wp-forecast_".$locale);?></h2> |
| 260 |
<?php if ($widgetcall == 0): ?><fieldset id="set1"><?php endif; ?> |
| 261 |
<div style="float: left; width: 49%"> |
| 262 |
<p><b><span class='wpfbcg'><input type='checkbox' name='ue_service' value='1' <?php echo ($ue_service=="1" ? "checked='checked'":""); ?> /></span><?php echo __('Weatherservice',"wp-forecast_".$locale)?>:</b> |
| 263 |
<select name="service" size="1" onchange="apifields(document.options.service.value);"> |
| 264 |
<option value="accu" <?php if ($av['service']=="accu") echo "selected=\"selected\""?>><?php echo __('AccuWeather',"wp-forecast_".$locale)?></option> |
| 265 |
<option value="bug" <?php if ($av['service']=="bug") echo "selected=\"selected\""?>><?php echo __('WeatherBug',"wp-forecast_".$locale)?></option> |
| 266 |
</select></p> |
| 267 |
|
| 268 |
<p><b><span class='wpfbcg'><input type='checkbox' name='ue_apikey1' value='1' <?php echo ($ue_apikey1=="1" ? "checked='checked'":""); ?> /></span><?php echo __('Partner-ID',"wp-forecast_".$locale)?>:</b> |
| 269 |
<input name="apikey1" type="text" size="30" maxlength="80" value="<?php echo $av['apikey1'] ?>" /></p> |
| 270 |
<!-- |
| 271 |
<p><?php echo __('Licensekey',"wp-forecast_".$locale)?>: |
| 272 |
<input name="apikey2" type="text" size="30" maxlength="80" value="<?php echo $av['apikey2'] ?>" /></p> |
| 273 |
--> |
| 274 |
<script type="text/javascript">apifields(document.options.service.value);</script> |
| 275 |
|
| 276 |
<p><b><span class='wpfbcg'><input type='checkbox' name='ue_location' value='1' <?php echo ($ue_location=="1" ? "checked='checked'":""); ?> /></span><?php echo __('Location',"wp-forecast_".$locale)?>:</b> |
| 277 |
<input name="location" type="text" size="30" maxlength="80" value="<?php echo $av['location'] ?>"<?php if ($widgetcall==1) echo "readonly" ?> /></p> |
| 278 |
<?php if (isset($_POST['set_loc'])) { ?> |
| 279 |
<p><b><?php echo __('Press Update options to save new location.',"wp-forecast_".$locale)?></b></p> |
| 280 |
<?php } ?> |
| 281 |
|
| 282 |
<p><b><span class='wpfbcg'><input type='checkbox' name='ue_locname' value='1' <?php echo ($ue_locname=="1" ? "checked='checked'":""); ?>/></span><?php echo __('Locationname',"wp-forecast_".$locale)?>:</b> |
| 283 |
<input name="locname" type="text" size="30" maxlength="80" value="<?php echo $av['locname'] ?>" /></p> |
| 284 |
|
| 285 |
<p><b><span class='wpfbcg'><input type='checkbox' name='ue_refresh' value='1' <?php echo ($ue_refresh=="1" ? "checked='checked'":""); ?>/></span><?php echo __('Refresh cache after',"wp-forecast_".$locale)?></b> |
| 286 |
<input name="refresh" type="text" size="10" maxlength="6" value="<?php echo $av['refresh'] ?>"/> |
| 287 |
<b><?php echo __('secs.',"wp-forecast_".$locale)?></b><br /></p> |
| 288 |
<p><b><span class='wpfbcg'><input type='checkbox' name='ue_metric' value='1' <?php echo ($ue_metric=="1" ? "checked='checked'":""); ?>/></span><?php echo __('Use metric units',"wp-forecast_".$locale)?>: </b><input type="checkbox" name="metric" value="1" <?php if ($av['metric']=="1") echo "checked=\"checked\""?> /> |
| 289 |
</p> |
| 290 |
|
| 291 |
<p><b><span class='wpfbcg'><input type='checkbox' name='ue_currtime' value='1' <?php echo ($ue_currtime=="1" ? "checked='checked'":""); ?>/></span><?php echo __('Use current time',"wp-forecast_".$locale)?>: </b><input type="checkbox" name="currtime" value="1" <?php if ($av['currtime']=="1") echo "checked=\"checked\""?> /> |
| 292 |
/ <b><?php echo __('Time-Offset',"wp-forecast_".$locale)?> :</b> <input type="text" name="timeoffset" size="5" maxlength="5" value="<?php echo $av['timeoffset'] ?>" /> <b><?php echo __('minutes',"wp-forecast_".$locale);?></b> |
| 293 |
</p> |
| 294 |
|
| 295 |
<p><b><span class='wpfbcg'><input type='checkbox' name='ue_windunit' value='1' <?php echo ($ue_windunit=="1" ? "checked='checked'":""); ?>/></span><?php echo __('Windspeed-Unit',"wp-forecast_".$locale)?>: </b><select name="windunit" size="1"> |
| 296 |
<option value="ms" <?php if ($av['windunit']=="ms") echo "selected=\"selected\""?>><?php echo __('Meter/Second (m/s)',"wp-forecast_".$locale)?></option> |
| 297 |
<option value="kmh" <?php if ($av['windunit']=="kmh") echo "selected=\"selected\""?>><?php echo __('Kilometer/Hour (km/h)',"wp-forecast_".$locale)?></option> |
| 298 |
<option value="mph" <?php if ($av['windunit']=="mph") echo "selected=\"selected\""?>><?php echo __('Miles/Hour (mph)',"wp-forecast_".$locale)?></option> |
| 299 |
<option value="kts" <?php if ($av['windunit']=="kts") echo "selected=\"selected\""?>><?php echo __('Knots (kts)',"wp-forecast_".$locale)?></option> |
| 300 |
<option value="bft" <?php if ($av['windunit']=="bft") echo "selected=\"selected\""?>><?php echo __('Beaufort (bft)',"wp-forecast_".$locale)?></option> |
| 301 |
</select></p> |
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
<p> |
| 307 |
<b><span class='wpfbcg'><input type='checkbox' name='ue_wpf_language' value='1' <?php echo ($ue_wpf_language=="1" ? "checked='checked'":""); ?>/></span><?php echo __('Language',"wp-forecast_".$locale)?>: </b><select name="wpf_language" size="1"> |
| 308 |
<option value="en_US" <?php if ($av['wpf_language']=="en_US") echo "selected=\"selected\""?>>english</option> |
| 309 |
<option value="de_DE" <?php if ($av['wpf_language']=="de_DE") echo "selected=\"selected\""?>>deutsch</option> |
| 310 |
<option value="da_DK" <?php if ($av['wpf_language']=="da_DK") echo "selected=\"selected\""?>>dansk</option> |
| 311 |
<option value="nl_NL" <?php if ($av['wpf_language']=="nl_NL") echo "selected=\"selected\""?>>dutch</option> |
| 312 |
<option value="fi_FI" <?php if ($av['wpf_language']=="fi_FI") echo "selected=\"selected\""?>>finnish</option> |
| 313 |
<option value="fr_FR" <?php if ($av['wpf_language']=="fr_FR") echo "selected=\"selected\""?>>french</option> |
| 314 |
<option value="hu_HU" <?php if ($av['wpf_language']=="hu_HU") echo "selected=\"selected\""?>>hungarian</option> |
| 315 |
<option value="it_IT" <?php if ($av['wpf_language']=="it_IT") echo "selected=\"selected\""?>>italian</option> |
| 316 |
<option value="pl_PL" <?php if ($av['wpf_language']=="pl_PL") echo "selected=\"selected\""?>>polish</option> |
| 317 |
<option value="pt_PT" <?php if ($av['wpf_language']=="pt_PT") echo "selected=\"selected\""?>>português</option> |
| 318 |
<option value="ro_RO" <?php if ($av['wpf_language']=="ro_RO") echo "selected=\"selected\""?>>romanian</option> |
| 319 |
<option value="ru_RU" <?php if ($av['wpf_language']=="ru_RU") echo "selected=\"selected\""?>>russian</option> |
| 320 |
<option value="nb_NO" <?php if ($av['wpf_language']=="nb_NO") echo "selected=\"selected\""?>>norwegian</option> |
| 321 |
<option value="es_ES" <?php if ($av['wpf_language']=="es_ES") echo "selected=\"selected\""?>>spanish</option> |
| 322 |
<option value="sv_SE" <?php if ($av['wpf_language']=="sv_SE") echo "selected=\"selected\""?>>swedish</option> |
| 323 |
|
| 324 |
</select></p> |
| 325 |
|
| 326 |
<p><b><span class='wpfbcg'><input type='checkbox' name='ue_pdforecast' value='1' <?php echo ($ue_pdforecast=="1" ? "checked='checked'":""); ?>/></span><?php echo __('Show forecast as ajax pull-down',"wp-forecast_".$locale)?>: </b><input type="checkbox" id="pdforecast" name="pdforecast" value="1" <?php if ($av['pdforecast']=="1") echo "checked=\"checked\""?> onchange="pdfields_update();" /> |
| 327 |
</p> |
| 328 |
|
| 329 |
<p> |
| 330 |
<b><span class='wpfbcg'><input type='checkbox' name='ue_pdfirstday' value='1' <?php echo ($ue_pdfirstday=="1" ? "checked='checked'":""); ?>/></span><?php echo __('First day in pull-down',"wp-forecast_".$locale)?>: </b><select id="pdfirstday" name="pdfirstday" size="1"> |
| 331 |
<option value="0" <?php if ($av['pdfirstday']=="0") echo "selected=\"selected\""?>>0</option> |
| 332 |
<option value="1" <?php if ($av['pdfirstday']=="1") echo "selected=\"selected\""?>>1</option> |
| 333 |
<option value="2" <?php if ($av['pdfirstday']=="2") echo "selected=\"selected\""?>>2</option> |
| 334 |
<option value="3" <?php if ($av['pdfirstday']=="3") echo "selected=\"selected\""?>>3</option> |
| 335 |
<option value="4" <?php if ($av['pdfirstday']=="4") echo "selected=\"selected\""?>>4</option> |
| 336 |
<option value="5" <?php if ($av['pdfirstday']=="5") echo "selected=\"selected\""?>>5</option> |
| 337 |
<option value="6" <?php if ($av['pdfirstday']=="6") echo "selected=\"selected\""?>>6</option> |
| 338 |
<option value="7" <?php if ($av['pdfirstday']=="7") echo "selected=\"selected\""?>>7</option> |
| 339 |
<option value="8" <?php if ($av['pdfirstday']=="8") echo "selected=\"selected\""?>>8</option> |
| 340 |
<option value="9" <?php if ($av['pdfirstday']=="9") echo "selected=\"selected\""?>>9</option> |
| 341 |
</select></p> |
| 342 |
<script type="text/javascript">pdfields_update();</script> |
| 343 |
|
| 344 |
</div> |
| 345 |
<!-- start of right column --> |
| 346 |
<div style="padding-left: 2%; float: left; width: 49%;"> |
| 347 |
<b><span class='wpfbcg'><input type='checkbox' name='ue_dispconfig' value='1' <?php echo ($ue_dispconfig=="1" ? "checked='checked'":""); ?>/></span> |
| 348 |
<?php echo __('Display Configuration',"wp-forecast_".$locale)?></b> |
| 349 |
<table> |
| 350 |
<tr> |
| 351 |
<td> </td> |
| 352 |
<td><?php echo __('Current Conditions',"wp-forecast_".$locale)?></td> |
| 353 |
<td><?php echo __('Forecast Day',"wp-forecast_".$locale)?></td> |
| 354 |
<td><?php echo __('Forecast Night',"wp-forecast_".$locale)?></td> |
| 355 |
</tr> |
| 356 |
<tr> |
| 357 |
<td><?php echo __('Icon',"wp-forecast_".$locale)?></td> |
| 358 |
<td align='center'><input type="checkbox" name="d_c_icon" value="1" |
| 359 |
<?php if (substr($av['dispconfig'],0,1)=="1") echo "checked=\"checked\""?> /></td> |
| 360 |
<td align='center'><input type="checkbox" name="d_d_icon" value="1" |
| 361 |
<?php if (substr($av['dispconfig'],10,1)=="1") echo "checked=\"checked\""?> /></td> |
| 362 |
<td align='center'><input type="checkbox" name="d_n_icon" value="1" |
| 363 |
<?php if (substr($av['dispconfig'],14,1)=="1") echo "checked=\"checked\""?> /></td> |
| 364 |
</tr> |
| 365 |
<tr> |
| 366 |
<td><?php echo __('Date',"wp-forecast_".$locale)?></td> |
| 367 |
<td align='center'><input type="checkbox" name="d_c_date" value="1" |
| 368 |
<?php if (substr($av['dispconfig'],18,1)=="1") echo "checked=\"checked\""?> /></td> |
| 369 |
<td align='center'> </td> |
| 370 |
<td align='center'> </td> |
| 371 |
</tr> |
| 372 |
<tr> |
| 373 |
<td><?php echo __('Time',"wp-forecast_".$locale)?></td> |
| 374 |
<td align='center'><input type="checkbox" name="d_c_time" value="1" |
| 375 |
<?php if (substr($av['dispconfig'],1,1)=="1") echo "checked=\"checked\""?> /></td> |
| 376 |
<td align='center'> </td> |
| 377 |
<td align='center'> </td> |
| 378 |
</tr> |
| 379 |
<tr> |
| 380 |
<td><?php echo __('Short Description',"wp-forecast_".$locale)?></td> |
| 381 |
<td align='center'><input type="checkbox" name="d_c_short" value="1" |
| 382 |
<?php if (substr($av['dispconfig'],2,1)=="1") echo "checked=\"checked\""?> /></td> |
| 383 |
<td align='center'><input type="checkbox" name="d_d_short" value="1" |
| 384 |
<?php if (substr($av['dispconfig'],11,1)=="1") echo "checked=\"checked\""?> /></td> |
| 385 |
<td align='center'><input type="checkbox" name="d_n_short" value="1" |
| 386 |
<?php if (substr($av['dispconfig'],15,1)=="1") echo "checked=\"checked\""?> /></td> |
| 387 |
</tr> |
| 388 |
<tr> |
| 389 |
<td><?php echo __('Temperature',"wp-forecast_".$locale)?></td> |
| 390 |
<td align='center'><input type="checkbox" name="d_c_temp" value="1" |
| 391 |
<?php if (substr($av['dispconfig'],3,1)=="1") echo "checked=\"checked\""?> /></td> |
| 392 |
<td align='center'><input type="checkbox" name="d_d_temp" value="1" |
| 393 |
<?php if (substr($av['dispconfig'],12,1)=="1") echo "checked=\"checked\""?> /></td> |
| 394 |
<td align='center'><input type="checkbox" name="d_n_temp" value="1" |
| 395 |
<?php if (substr($av['dispconfig'],16,1)=="1") echo "checked=\"checked\""?> /></td> |
| 396 |
</tr> |
| 397 |
<tr> |
| 398 |
<td><?php echo __('Realfeel',"wp-forecast_".$locale)?></td> |
| 399 |
<td align='center'><input type="checkbox" name="d_c_real" value="1" |
| 400 |
<?php if (substr($av['dispconfig'],4,1)=="1") echo "checked=\"checked\""?> /></td> |
| 401 |
<td align='center'> </td> |
| 402 |
<td align='center'> </td> |
| 403 |
</tr> |
| 404 |
<tr> |
| 405 |
<td><?php echo __('Pressure',"wp-forecast_".$locale)?></td> |
| 406 |
<td align='center'><input type="checkbox" name="d_c_press" value="1" |
| 407 |
<?php if (substr($av['dispconfig'],5,1)=="1") echo "checked=\"checked\""?> /></td> |
| 408 |
<td align='center'> </td> |
| 409 |
<td align='center'> </td> |
| 410 |
</tr> |
| 411 |
<tr> |
| 412 |
<td><?php echo __('Humidity',"wp-forecast_".$locale)?></td> |
| 413 |
<td align='center'><input type="checkbox" name="d_c_humid" value="1" |
| 414 |
<?php if (substr($av['dispconfig'],6,1)=="1") echo "checked=\"checked\""?> /></td> |
| 415 |
<td align='center'> </td> |
| 416 |
<td align='center'> </td> |
| 417 |
</tr> |
| 418 |
<tr> |
| 419 |
<td><?php echo __('Wind',"wp-forecast_".$locale)?></td> |
| 420 |
<td align='center'><input type="checkbox" name="d_c_wind" value="1" |
| 421 |
<?php if (substr($av['dispconfig'],7,1)=="1") echo "checked=\"checked\""?> /></td> |
| 422 |
<td align='center'><input type="checkbox" name="d_d_wind" value="1" |
| 423 |
<?php if (substr($av['dispconfig'],13,1)=="1") echo "checked=\"checked\""?> /></td> |
| 424 |
<td align='center'><input type="checkbox" name="d_n_wind" value="1" |
| 425 |
<?php if (substr($av['dispconfig'],17,1)=="1") echo "checked=\"checked\""?> /></td> |
| 426 |
</tr> |
| 427 |
<tr> |
| 428 |
<td><?php echo __('Windgusts',"wp-forecast_".$locale)?></td> |
| 429 |
<td align='center'><input type="checkbox" name="d_c_wgusts" value="1" |
| 430 |
<?php if (substr($av['dispconfig'],22,1)=="1") echo "checked=\"checked\""?> /></td> |
| 431 |
<td align='center'><input type="checkbox" name="d_d_wgusts" value="1" |
| 432 |
<?php if (substr($av['dispconfig'],23,1)=="1") echo "checked=\"checked\""?> /></td> |
| 433 |
<td align='center'><input type="checkbox" name="d_n_wgusts" value="1" |
| 434 |
<?php if (substr($av['dispconfig'],24,1)=="1") echo "checked=\"checked\""?> /></td> |
| 435 |
</tr> |
| 436 |
<tr> |
| 437 |
<td><?php echo __('Sunrise',"wp-forecast_".$locale)?></td> |
| 438 |
<td align='center'><input type="checkbox" name="d_c_sunrise" value="1" |
| 439 |
<?php if (substr($av['dispconfig'],8,1)=="1") echo "checked=\"checked\""?> /></td> |
| 440 |
<td align='center'> </td> |
| 441 |
<td align='center'> </td> |
| 442 |
</tr> |
| 443 |
<tr> |
| 444 |
<td><?php echo __('Sunset',"wp-forecast_".$locale)?></td> |
| 445 |
<td align='center'><input type="checkbox" name="d_c_sunset" value="1" |
| 446 |
<?php if (substr($av['dispconfig'],9,1)=="1") echo "checked=\"checked\""?> /></td> |
| 447 |
<td align='center'> </td> |
| 448 |
<td align='center'> </td> |
| 449 |
</tr> |
| 450 |
<tr> |
| 451 |
<td><?php echo __('Copyright',"wp-forecast_".$locale)?></td> |
| 452 |
<td align='center'><input type="checkbox" name="d_c_copyright" value="1" |
| 453 |
<?php if (substr($av['dispconfig'],21,1)=="1") echo "checked=\"checked\""?> /></td> |
| 454 |
<td align='center'> </td> |
| 455 |
<td align='center'> </td> |
| 456 |
</tr> |
| 457 |
<tr> |
| 458 |
<td><?php echo __('Link to Weatherprovider',"wp-forecast_".$locale)?></td> |
| 459 |
<td align='center'><input type="checkbox" name="d_c_accuweather" id="d_c_accuweather" value="1" |
| 460 |
<?php if (substr($av['dispconfig'],25,1)=="1") echo "checked=\"checked\""?> onchange="nwfields_update();" /></td> |
| 461 |
<td colspan="2" align='left'>(<?php echo __('Open in new Window',"wp-forecast_".$locale)?>: |
| 462 |
<input type="checkbox" name="d_c_aw_newwindow" id="d_c_aw_newwindow" value="1" |
| 463 |
<?php if (substr($av['dispconfig'],26,1)=="1") echo "checked=\"checked\""?> />)</td> |
| 464 |
</tr> |
| 465 |
</table> |
| 466 |
<br /> |
| 467 |
<script type="text/javascript">nwfields_update();</script> |
| 468 |
|
| 469 |
<b><span class='wpfbcg'><input type='checkbox' name='ue_forecast' value='1' <?php echo ($ue_forecast=="1" ? "checked='checked'":""); ?>/></span><?php echo __('Forecast',"wp-forecast_".$locale)?></b> |
| 470 |
|
| 471 |
<table> |
| 472 |
<tr> |
| 473 |
<td> </td> |
| 474 |
<td><?php echo __('All',"wp-forecast_".$locale)?></td> |
| 475 |
<td><?php echo __('Day',"wp-forecast_".$locale)?> 1</td> |
| 476 |
<td><?php echo __('Day',"wp-forecast_".$locale)?> 2</td> |
| 477 |
<td><?php echo __('Day',"wp-forecast_".$locale)?> 3</td> |
| 478 |
<td><?php echo __('Day',"wp-forecast_".$locale)?> 4</td> |
| 479 |
<td><?php echo __('Day',"wp-forecast_".$locale)?> 5</td> |
| 480 |
<td><?php echo __('Day',"wp-forecast_".$locale)?> 6</td> |
| 481 |
<td><?php echo __('Day',"wp-forecast_".$locale)?> 7</td> |
| 482 |
<td><?php echo __('Day',"wp-forecast_".$locale)?> 8</td> |
| 483 |
<td><?php echo __('Day',"wp-forecast_".$locale)?> 9</td> |
| 484 |
</tr> |
| 485 |
<tr><td><?php echo __('Daytime',"wp-forecast_".$locale)?></td> |
| 486 |
<td><input type="checkbox" name="alldays" onclick="this.value=check('day')" /></td> |
| 487 |
<td><input type="checkbox" name="day1" value="1" |
| 488 |
<?php if (substr($av['daytime'],0,1)=="1") echo "checked=\"checked\""?> /></td> |
| 489 |
<td><input type="checkbox" name="day2" value="1" |
| 490 |
<?php if (substr($av['daytime'],1,1)=="1") echo "checked=\"checked\""?> /></td> |
| 491 |
<td><input type="checkbox" name="day3" value="1" |
| 492 |
<?php if (substr($av['daytime'],2,1)=="1") echo "checked=\"checked\""?> /></td> |
| 493 |
<td><input type="checkbox" name="day4" value="1" |
| 494 |
<?php if (substr($av['daytime'],3,1)=="1") echo "checked=\"checked\""?> /></td> |
| 495 |
<td><input type="checkbox" name="day5" value="1" |
| 496 |
<?php if (substr($av['daytime'],4,1)=="1") echo "checked=\"checked\""?> /></td> |
| 497 |
<td><input type="checkbox" name="day6" value="1" |
| 498 |
<?php if (substr($av['daytime'],5,1)=="1") echo "checked=\"checked\""?> /></td> |
| 499 |
<td><input type="checkbox" name="day7" value="1" |
| 500 |
<?php if (substr($av['daytime'],6,1)=="1") echo "checked=\"checked\""?> /></td> |
| 501 |
<td><input type="checkbox" name="day8" value="1" |
| 502 |
<?php if (substr($av['daytime'],7,1)=="1") echo "checked=\"checked\""?> /></td> |
| 503 |
<td><input type="checkbox" name="day9" value="1" |
| 504 |
<?php if (substr($av['daytime'],8,1)=="1") echo "checked=\"checked\""?> /></td> |
| 505 |
</tr> |
| 506 |
<tr><td><?php echo __('Nighttime',"wp-forecast_".$locale)?></td> |
| 507 |
<td><input type="checkbox" name="allnight" onclick="this.value=check('night')" /></td> |
| 508 |
<td><input type="checkbox" name="night1" value="1" |
| 509 |
<?php if (substr($av['nighttime'],0,1)=="1") echo "checked=\"checked\""?> /></td> |
| 510 |
<td><input type="checkbox" name="night2" value="1" |
| 511 |
<?php if (substr($av['nighttime'],1,1)=="1") echo "checked=\"checked\""?> /></td> |
| 512 |
<td><input type="checkbox" name="night3" value="1" |
| 513 |
<?php if (substr($av['nighttime'],2,1)=="1") echo "checked=\"checked\""?> /></td> |
| 514 |
<td><input type="checkbox" name="night4" value="1" |
| 515 |
<?php if (substr($av['nighttime'],3,1)=="1") echo "checked=\"checked\""?> /></td> |
| 516 |
<td><input type="checkbox" name="night5" value="1" |
| 517 |
<?php if (substr($av['nighttime'],4,1)=="1") echo "checked=\"checked\""?> /></td> |
| 518 |
<td><input type="checkbox" name="night6" value="1" |
| 519 |
<?php if (substr($av['nighttime'],5,1)=="1") echo "checked=\"checked\""?> /></td> |
| 520 |
<td><input type="checkbox" name="night7" value="1" |
| 521 |
<?php if (substr($av['nighttime'],6,1)=="1") echo "checked=\"checked\""?> /></td> |
| 522 |
<td><input type="checkbox" name="night8" value="1" |
| 523 |
<?php if (substr($av['nighttime'],7,1)=="1") echo "checked=\"checked\""?> /></td> |
| 524 |
<td><input type="checkbox" name="night9" value="1" |
| 525 |
<?php if (substr($av['nighttime'],8,1)=="1") echo "checked=\"checked\""?> /></td> |
| 526 |
</tr> |
| 527 |
</table> |
| 528 |
</div> |
| 529 |
<!-- finally update field attributes --> |
| 530 |
<script type="text/javascript"> |
| 531 |
apifields(document.options.service.value); |
| 532 |
</script> |
| 533 |
</fieldset> |
| 534 |
<?php |
| 535 |
echo "<div class='submit'><input class='button-primary' type='submit' name='info_update' value='".__('Update options',"wp-forecast_".$locale)." ยป' /></div>"; |
| 536 |
|
| 537 |
?> |
| 538 |
</div></form></div> |
| 539 |
<?php |
| 540 |
|
| 541 |
pdebug(1,"End of wpf_sub_admin_form ()"); |
| 542 |
} |
| 543 |
?> |