本文整理汇总了PHP中Options_Framework::_wwm_2015_optionsframework_options方法的典型用法代码示例。如果您正苦于以下问题:PHP Options_Framework::_wwm_2015_optionsframework_options方法的具体用法?PHP Options_Framework::_wwm_2015_optionsframework_options怎么用?PHP Options_Framework::_wwm_2015_optionsframework_options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Options_Framework
的用法示例。
在下文中一共展示了Options_Framework::_wwm_2015_optionsframework_options方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: optionsframework_fields
/**
* Generates the options fields that are used in the form.
*/
static function optionsframework_fields()
{
global $allowedtags;
$optionsframework_settings = get_option('optionsframework');
// Gets the unique option id
if (isset($optionsframework_settings['id'])) {
$option_name = $optionsframework_settings['id'];
} else {
$option_name = 'optionsframework';
}
$settings = get_option($option_name);
$options =& Options_Framework::_wwm_2015_optionsframework_options();
$counter = 0;
$menu = '';
foreach ($options as $value) {
$val = '';
$select_value = '';
$output = '';
// Wrap all options
if ($value['type'] != "heading" && $value['type'] != "info") {
// Keep all ids lowercase with no spaces
$value['id'] = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($value['id']));
$id = 'section-' . $value['id'];
$class = 'section';
if (isset($value['type'])) {
$class .= ' section-' . $value['type'];
}
if (isset($value['class'])) {
$class .= ' ' . $value['class'];
}
$output .= '<div id="' . esc_attr($id) . '" class="' . esc_attr($class) . '"><div class="section_inner">' . "\n";
if (isset($value['name'])) {
$output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
}
if ($value['type'] != 'editor') {
$output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
} else {
$output .= '<div class="option">' . "\n" . '<div>' . "\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') {
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'];
}
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 .= '<input id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" type="text" value="' . esc_attr($val) . '" />';
break;
// Password input
// Password input
case 'password':
$output .= '<input id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" type="password" value="' . esc_attr($val) . '" />';
break;
// Textarea
// 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 .= '<textarea id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" rows="' . $rows . '">' . esc_textarea($val) . '</textarea>';
break;
// Select Box
// Select Box
case 'select':
$output .= '<select class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '">';
foreach ($value['options'] as $key => $option) {
$output .= '<option' . selected($val, $key, false) . ' value="' . esc_attr($key) . '">' . esc_html($option) . '</option>';
}
$output .= '</select>';
break;
// Radio Box
// Radio Box
case "radio":
//.........这里部分代码省略.........
示例2: get_default_values
/**
* Get the default values for all the theme options
*
* Get an array of all default values as set in
* options.php. The 'id','std' and 'type' keys need
* to be defined in the configuration array. In the
* event that these keys are not present the option
* will not be included in this function's output.
*
* @return array Re-keyed options configuration array.
*
*/
function get_default_values()
{
$output = array();
$config =& Options_Framework::_wwm_2015_optionsframework_options();
foreach ((array) $config as $option) {
if (!isset($option['id'])) {
continue;
}
if (!isset($option['std'])) {
continue;
}
if (!isset($option['type'])) {
continue;
}
if (has_filter('of_sanitize_' . $option['type'])) {
$output[$option['id']] = apply_filters('of_sanitize_' . $option['type'], $option['std'], $option);
}
}
return $output;
}