File: //home/Test/wp/wp-content/plugins/5sec-maintenance-mode/wf-mm-common.php
<?php
/*
Maintenance Mode Common functions
v1.1
(c) Web factory Ltd, 2011.
www.webfactoryltd.com
*/
class wf_mm_common extends wf_mm {
// helper function for creating select's options
static function create_select_options($options, $selected = null, $output = true) {
$out = "\n";
foreach ($options as $tmp) {
if ($selected == $tmp['val']) {
$out .= "<option selected=\"selected\" value=\"{$tmp['val']}\">{$tmp['label']} </option>\n";
} else {
$out .= "<option value=\"{$tmp['val']}\">{$tmp['label']} </option>\n";
}
}
if($output) {
echo $out;
} else {
return $out;
}
} // create_select_options
// helper function for $_POST checkbox handling
static function check_var_isset(&$values, $variables) {
foreach ($variables as $key => $value) {
if (!isset($values[$key])) {
$values[$key] = $value;
}
}
} // check_var_isset
// checkbox helper function
static function checked($value, $option, $echo = false) {
$out = '';
if (!is_array($option)) {
$option = (array) $option;
}
if (in_array($value, $option)) {
$out = ' checked="checked" ';
}
if ($echo) {
echo $out;
} else {
return $out;
}
} // wf_checked
} // wf_mm_common class