2024-03-16 14:21:57 +01:00
|
|
|
<?php
|
2024-03-23 20:46:44 +01:00
|
|
|
function _kompass_print_textbox($settingName, $settingValue, $style = '') {
|
2024-03-16 14:21:57 +01:00
|
|
|
echo '<input style="' . $style . '" type="text" name="' . $settingName . '" value="' . $settingValue. '" />';
|
|
|
|
if (defined('WP_DEBUG') && WP_DEBUG == true) {
|
|
|
|
echo '<br />' . $settingName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-23 20:46:44 +01:00
|
|
|
function kompass_print_textbox(array $args) {
|
|
|
|
if (!isset($args['setting'])) {
|
|
|
|
wp_die('Missing argument setting at text-element ' . print_r($args, true));
|
|
|
|
}
|
2024-03-16 14:21:57 +01:00
|
|
|
$setting = get_option($args['setting'], null);
|
2024-03-23 20:46:44 +01:00
|
|
|
$setting = $setting ?? ( $args['value'] ?? '' );
|
|
|
|
|
2024-03-16 14:21:57 +01:00
|
|
|
$style = isset($args['style']) ? $args['style'] : '';
|
|
|
|
|
|
|
|
$value = esc_attr($setting);
|
|
|
|
if (isset($args['unit_division'])) {
|
|
|
|
$value = (int)$value / (int)$args['unit_division'];
|
|
|
|
}
|
|
|
|
|
2024-03-23 20:46:44 +01:00
|
|
|
if ($value === null && isset($args['value'])) {
|
|
|
|
$value = $args['value'];
|
|
|
|
}
|
|
|
|
_kompass_print_textbox($args['setting'], $value, $style);
|
2024-03-16 14:21:57 +01:00
|
|
|
}
|