' . "\n" . '
' . "\n";
}
}
// Set default value to $val
if (isset($value['std'])) {
$val = $value['std'];
}
// If the option is already saved, override $val
if (($value['type'] != 'heading') && ($value['type'] != 'info') && ($value['type'] != "about")) {
if (isset($settings[($value['id'])])) {
$val = $settings[($value['id'])];
// Striping slashes of non-array options
if (!is_array($val)) {
$val = stripslashes($val);
}
}
}
// If there is a description save it for labels
$explain_value = '';
if (isset($value['desc'])) {
$explain_value = $value['desc'];
}
// Set the placeholder if one exists
$placeholder = '';
if (isset($value['placeholder'])) {
$placeholder = ' placeholder="' . esc_attr($value['placeholder']) . '"';
}
if (has_filter('optionsframework_' . $value['type'])) {
$output .= apply_filters('optionsframework_' . $value['type'], $option_name, $value, $val);
}
switch ($value['type']) {
// Basic text input
case 'text':
$output .= '
';
break;
// Password input
case 'password':
$output .= '
';
break;
// Textarea
case 'textarea':
$rows = '8';
if (isset($value['settings']['rows'])) {
$custom_rows = $value['settings']['rows'];
if (is_numeric($custom_rows)) {
$rows = $custom_rows;
}
}
$val = stripslashes($val);
$output .= '
';
break;
// Select Box
case 'select':
$output .= '
';
break;
// Radio Box
case "radio":
$name = $option_name . '[' . $value['id'] . ']';
foreach ($value['options'] as $key => $option) {
$id = $option_name . '-' . $value['id'] . '-' . $key;
$output .= '
';
}
break;
// Image Selectors
case "images":
$name = $option_name . '[' . $value['id'] . ']';
foreach ($value['options'] as $key => $option) {
$selected = '';
if ($val != '' && ($val == $key)) {
$selected = ' of-radio-img-selected';
}
$output .= '
';
$output .= '
' . esc_html($key) . '
';
$output .= '
 . ')
';
}
break;
// Checkbox
case "checkbox":
$output .= '
';
$output .= '
';
break;
// Color picker
case "color":
$default_color = '';
if (isset($value['std'])) {
if ($val != $value['std']) {
$default_color = ' data-default-color="' . $value['std'] . '" ';
}
}
$output .= '
';
break;
// Uploader
case "upload":
$output .= Options_Framework_Media_Uploader::optionsframework_uploader($value['id'], $val, null);
break;
case "info":
$id = '';
$class = 'section';
if (isset($value['id'])) {
$id = 'id="' . esc_attr($value['id']) . '" ';
}
if (isset($value['type'])) {
$class .= ' section-' . $value['type'];
}
if (isset($value['class'])) {
$class .= ' ' . $value['class'];
}
$output .= '
' . "\n";
if (isset($value['name'])) {
$output .= '
' . esc_html($value['name']) . '
' . "\n";
}
if (isset($value['desc'])) {
$output .= $value['desc'] . "\n";
}
$output .= '' . "\n";
break;
case "about":
global $wp_version;
$version = $wp_version;
$output .= '
' . __('基础信息', 'kratos') . '
- ' . __('PHP 版本:', 'kratos') . PHP_VERSION . '
- ' . __('Kratos 版本:', 'kratos') . THEME_VERSION . '
- ' . __('WordPress 版本:', 'kratos') . $version . '
- ' . __('User Agent 信息:', 'kratos') . $_SERVER['HTTP_USER_AGENT'] . '
' . __('提示:在提交主题相关问题反馈时,请将上面「基础信息」中的内容复制到环境信息中。', 'kratos') . '
' . __('资料文档', 'kratos') . '
' . __('讨论交流', 'kratos') . '
' . __('版权声明', 'kratos') . '
' . __('主题源码使用 MIT 协议 进行许可,说明文档使用 CC BY-NC-ND 4.0 进行许可。', 'kratos') . '
' . __('打赏支持', 'kratos') . '
';
break;
case "sendmail":
$output .= '
';
break;
// Heading for Navigation
case "heading":
$counter++;
if ($counter >= 2) {
$output .= '
' . "\n";
}
$class = '';
$class = !empty($value['id']) ? $value['id'] : $value['name'];
$class = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($class));
$output .= '
';
if (($value['type'] != "checkbox") && ($value['type'] != "editor")) {
$output .= '
' . wp_kses($explain_value, $allowedtags) . '
' . "\n";
}
$output .= '