/** * 編集フォームinput用HTMLを得る(関数内でPC、携帯用表示を振り分け) * * @return string */ function getEditConfHtml($name, $description_ht) { global $_conf, $conf_user_def, $conf_user_sel; // デフォルト値の規定がなければ、空白を返す if (!isset($conf_user_def[$name])) { return ''; } $name_view = $_conf[$name]; if (empty($_conf['ktai'])) { $input_size_at = ' size="38"'; } else { $input_size_at = ''; } // select 選択形式なら if (isset($conf_user_sel[$name])) { $form_ht = getEditConfSelHtml($name); $key = $conf_user_def[$name]; $def_views[$name] = htmlspecialchars($conf_user_sel[$name][$key], ENT_QUOTES); // input 入力式なら } else { $form_ht = <<<EOP <input type="text" name="conf_edit[{$name}]" value="{$name_view}"{$input_size_at}> EOP; if (is_string($conf_user_def[$name])) { $def_views[$name] = htmlspecialchars($conf_user_def[$name], ENT_QUOTES); } else { $def_views[$name] = $conf_user_def[$name]; } } $r = <<<EOP [{$name}]<br> {$description_ht}<br> {$form_ht}<br> <br> EOP; return $r; }
/** * 編集フォームinput用HTMLを得る(関数内でPC、携帯用表示を振り分け) * * @param stirng $name 設定項目名 * @param string $description_ht HTML形式の説明 * @param int $flags 表示モード * @return string */ function getEditConfHtml($name, $description_ht, $flags) { global $_conf, $conf_user_def, $conf_user_sel, $conf_user_rad; // デフォルト値の規定がなければ、空白を返す if (!isset($conf_user_def[$name])) { return ''; } $name_view = p2h($_conf[$name]); // 無効or非表示なら if ($flags & (P2_EDIT_CONF_USER_HIDDEN | P2_EDIT_CONF_USER_DISABLED)) { $form_ht = getEditConfHidHtml($name); // 携帯ならそのまま返す if ($_conf['ktai']) { return $form_ht; } if ($name_view === '') { $form_ht .= '<i>(empty)</i>'; } else { $form_ht .= $name_view; } if (is_string($conf_user_def[$name])) { $def_views[$name] = p2h($conf_user_def[$name]); } else { $def_views[$name] = strval($conf_user_def[$name]); } // select 選択形式なら } elseif (isset($conf_user_sel[$name])) { $form_ht = getEditConfSelHtml($name); $key = $conf_user_def[$name]; $def_views[$name] = p2h($conf_user_sel[$name][$key]); // radio 選択形式なら } elseif (isset($conf_user_rad[$name])) { $form_ht = getEditConfRadHtml($name); $key = $conf_user_def[$name]; $def_views[$name] = p2h($conf_user_rad[$name][$key]); // input 入力式なら } else { if (!$_conf['ktai']) { $input_size_at = sprintf(' size="%d"', $flags & P2_EDIT_CONF_USER_LONGTEXT ? 40 : 20); } else { $input_size_at = ''; } $input_type = $flags & P2_EDIT_CONF_USER_PASSWORD ? 'password' : 'text'; $form_ht = <<<EOP <input type="{$input_type}" name="conf_edit[{$name}]" value="{$name_view}"{$input_size_at}> EOP; if (is_string($conf_user_def[$name])) { $def_views[$name] = p2h($conf_user_def[$name]); } else { $def_views[$name] = strval($conf_user_def[$name]); } } // iPhone用 if ($_conf['iphone']) { return "<fieldset><legend>{$name}</legend>{$description_ht}<br>{$form_ht}</fieldset>\n"; // 携帯用 } elseif ($_conf['ktai']) { return "[{$name}]<br>{$description_ht}<br>{$form_ht}<br><br>\n"; // PC用 } else { return <<<EOP <tr title="デフォルト値: {$def_views[$name]}"> <td>{$name}</td> <td>{$form_ht}</td> <td>{$description_ht}</td> </tr> EOP; } }
/** * 編集フォームinput用HTMLを得る(関数内でPC、携帯用表示を振り分け) * * @return string */ function getEditConfHtml($name, $description_ht) { global $_conf, $conf_user_def, $conf_user_sel; // デフォルト値の規定がなければ、空白を返す if (!isset($conf_user_def[$name])) { return ''; } // 携帯では編集表示しない項目 if ($_conf['ktai']) { $noKtais = array('enable_headbar', 'enable_spm', 'spm_kokores', 'frame_menu_width', 'frame_subject_width', 'frame_read_width'); if (in_array($name, $noKtais)) { return sprintf('<input type="hidden" name="conf_edit[%s]" value="%s">' . "\n", hs($name), hs($_conf[$name])); } } $name_view_hs = hs($_conf[$name]); if (!$_conf['ktai']) { $input_size_at = ' size="38"'; } else { $input_size_at = ''; } // select 選択形式なら if (isset($conf_user_sel[$name])) { $form_ht = getEditConfSelHtml($name); $key = $conf_user_def[$name]; $def_views[$name] = htmlspecialchars($conf_user_sel[$name][$key], ENT_QUOTES); // input 入力式なら } else { $form_ht = <<<EOP <input type="text" name="conf_edit[{$name}]" value="{$name_view_hs}"{$input_size_at}> EOP; $def_views[$name] = htmlspecialchars($conf_user_def[$name], ENT_QUOTES); } $r = <<<EOP [{$name}]<br> {$description_ht}<br> {$form_ht}<br> <br> EOP; return $r; }