本文整理汇总了PHP中ot_loop_through_choices函数的典型用法代码示例。如果您正苦于以下问题:PHP ot_loop_through_choices函数的具体用法?PHP ot_loop_through_choices怎么用?PHP ot_loop_through_choices使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ot_loop_through_choices函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ot_settings_view
function ot_settings_view($name, $key, $setting = array())
{
$child = strpos($name, '][settings]') !== false ? true : false;
$type = isset($setting['type']) ? $setting['type'] : '';
$std = isset($setting['std']) ? $setting['std'] : '';
$operator = isset($setting['operator']) ? esc_attr($setting['operator']) : 'and';
// Serialize the standard value just incase
if (is_array($std)) {
$std = maybe_serialize($std);
}
if (in_array($type, array('textarea', 'textarea-simple', 'css'))) {
$std_form_element = '<textarea class="textarea" rows="10" cols="40" name="' . esc_attr($name) . '[' . esc_attr($key) . '][std]">' . esc_html($std) . '</textarea>';
} else {
$std_form_element = '<input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][std]" value="' . esc_attr($std) . '" class="widefat option-tree-ui-input" autocomplete="off" />';
}
return '
<div class="option-tree-setting">
<div class="open">' . (isset($setting['label']) ? esc_attr($setting['label']) : 'Setting ' . ($key + 1)) . '</div>
<div class="button-section">
<a href="javascript:void(0);" class="option-tree-setting-edit option-tree-ui-button button left-item" title="' . __('Edit', 'option-tree') . '">
<span class="icon ot-icon-pencil"></span>' . __('Edit', 'option-tree') . '
</a>
<a href="javascript:void(0);" class="option-tree-setting-remove option-tree-ui-button button button-secondary light right-item" title="' . __('Delete', 'option-tree') . '">
<span class="icon ot-icon-trash-o"></span>' . __('Delete', 'option-tree') . '
</a>
</div>
<div class="option-tree-setting-body">
<div class="format-settings">
<div class="format-setting type-text wide-desc">
<div class="description">' . __('<strong>Label</strong>: Displayed as the label of a form element on the Theme Options page.', 'option-tree') . '</div>
<div class="format-setting-inner">
<input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][label]" value="' . (isset($setting['label']) ? esc_attr($setting['label']) : '') . '" class="widefat option-tree-ui-input option-tree-setting-title" autocomplete="off" />
</div>
</div>
</div>
<div class="format-settings">
<div class="format-setting type-text wide-desc">
<div class="description">' . __('<strong>ID</strong>: A unique lower case alphanumeric string, underscores allowed.', 'option-tree') . '</div>
<div class="format-setting-inner">
<input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][id]" value="' . (isset($setting['id']) ? esc_attr($setting['id']) : '') . '" class="widefat option-tree-ui-input" autocomplete="off" />
</div>
</div>
</div>
<div class="format-settings">
<div class="format-setting type-select wide-desc">
<div class="description">' . __('<strong>Type</strong>: Choose one of the available option types from the dropdown.', 'option-tree') . '</div>
<div class="format-setting-inner">
<select name="' . esc_attr($name) . '[' . esc_attr($key) . '][type]" value="' . esc_attr($type) . '" class="option-tree-ui-select">
' . ot_loop_through_option_types($type, $child) . '
</select>
</div>
</div>
</div>
<div class="format-settings">
<div class="format-setting type-textarea wide-desc">
<div class="description">' . __('<strong>Description</strong>: Enter a detailed description for the users to read on the Theme Options page, HTML is allowed. This is also where you enter content for both the Textblock & Textblock Titled option types.', 'option-tree') . '</div>
<div class="format-setting-inner">
<textarea class="textarea" rows="10" cols="40" name="' . esc_attr($name) . '[' . esc_attr($key) . '][desc]">' . (isset($setting['desc']) ? esc_html($setting['desc']) : '') . '</textarea>
</div>
</div>
</div>
<div class="format-settings">
<div class="format-setting type-textblock wide-desc">
<div class="description">' . __('<strong>Choices</strong>: This will only affect the following option types: Checkbox, Radio, Select & Select Image.', 'option-tree') . '</div>
<div class="format-setting-inner">
<ul class="option-tree-setting-wrap option-tree-sortable" data-name="' . esc_attr($name) . '[' . esc_attr($key) . ']">
' . (isset($setting['choices']) ? ot_loop_through_choices($name . '[' . $key . ']', $setting['choices']) : '') . '
</ul>
<a href="javascript:void(0);" class="option-tree-choice-add option-tree-ui-button button hug-left">' . __('Add Choice', 'option-tree') . '</a>
</div>
</div>
</div>
<div class="format-settings">
<div class="format-setting type-textblock wide-desc">
<div class="description">' . __('<strong>Settings</strong>: This will only affect the List Item option type.', 'option-tree') . '</div>
<div class="format-setting-inner">
<ul class="option-tree-setting-wrap option-tree-sortable" data-name="' . esc_attr($name) . '[' . esc_attr($key) . ']">
' . (isset($setting['settings']) ? ot_loop_through_sub_settings($name . '[' . $key . '][settings]', $setting['settings']) : '') . '
</ul>
<a href="javascript:void(0);" class="option-tree-list-item-setting-add option-tree-ui-button button hug-left">' . __('Add Setting', 'option-tree') . '</a>
</div>
</div>
</div>
<div class="format-settings">
<div class="format-setting type-text wide-desc">
<div class="description">' . __('<strong>Standard</strong>: Setting the standard value for your option only works for some option types. Read the <code>OptionTree->Documentation</code> for more information on which ones.', 'option-tree') . '</div>
<div class="format-setting-inner">
' . $std_form_element . '
</div>
</div>
</div>
<div class="format-settings">
<div class="format-setting type-text wide-desc">
<div class="description">' . __('<strong>Rows</strong>: Enter a numeric value for the number of rows in your textarea. This will only affect the following option types: CSS, Textarea, & Textarea Simple.', 'option-tree') . '</div>
<div class="format-setting-inner">
<input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][rows]" value="' . (isset($setting['rows']) ? esc_attr($setting['rows']) : '') . '" class="widefat option-tree-ui-input" />
</div>
</div>
</div>
//.........这里部分代码省略.........
示例2: ot_settings_view
function ot_settings_view($name, $key, $setting = array())
{
$child = strpos($name, '][settings]') !== false ? true : false;
$type = isset($setting['type']) ? $setting['type'] : '';
$std = isset($setting['std']) ? $setting['std'] : '';
// Serialize the standard value just incase
if (is_array($std)) {
$std = maybe_serialize($std);
}
if (in_array($type, array('textarea', 'textarea-simple', 'css'))) {
$std_form_element = '<textarea class="textarea" rows="10" cols="40" name="' . esc_attr($name) . '[' . esc_attr($key) . '][std]">' . esc_html($std) . '</textarea>';
} else {
$std_form_element = '<input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][std]" value="' . esc_attr($std) . '" class="widefat option-tree-ui-input" autocomplete="off" />';
}
return '
<div class="option-tree-setting">
<div class="open">' . (isset($setting['label']) ? esc_attr($setting['label']) : 'Setting ' . ($key + 1)) . '</div>
<div class="button-section">
<a href="javascript:void(0);" class="option-tree-setting-edit option-tree-ui-button left-item" title="' . __('Edit', 'option-tree') . '">
<span class="icon pencil">' . __('Edit', 'option-tree') . '</span>
</a>
<a href="javascript:void(0);" class="option-tree-setting-remove option-tree-ui-button right-item" title="' . __('Delete', 'option-tree') . '">
<span class="icon trash-can">' . __('Delete', 'option-tree') . '</span>
</a>
</div>
<div class="option-tree-setting-body">
<div class="format-settings">
<div class="format-setting type-text wide-desc">
<div class="description">' . __('<strong>Label</strong>: Displayed as the label of a form element on the Theme Options page.', 'option-tree') . '</div>
<div class="format-setting-inner">
<input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][label]" value="' . (isset($setting['label']) ? esc_attr($setting['label']) : '') . '" class="widefat option-tree-ui-input option-tree-setting-title" autocomplete="off" />
</div>
</div>
</div>
<div class="format-settings">
<div class="format-setting type-text wide-desc">
<div class="description">' . __('<strong>ID</strong>: A unique lower case alphanumeric string, underscores allowed.', 'option-tree') . '</div>
<div class="format-setting-inner">
<input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][id]" value="' . (isset($setting['id']) ? esc_attr($setting['id']) : '') . '" class="widefat option-tree-ui-input" autocomplete="off" />
</div>
</div>
</div>
<div class="format-settings">
<div class="format-setting type-select wide-desc">
<div class="description">' . __('<strong>Type</strong>: Choose one of the available option types from the dropdown.', 'option-tree') . '</div>
<div class="format-setting-inner">
<select name="' . esc_attr($name) . '[' . esc_attr($key) . '][type]" value="' . esc_attr($type) . '" class="option-tree-ui-select">
' . ot_loop_through_option_types($type, $child) . '
</select>
</div>
</div>
</div>
<div class="format-settings">
<div class="format-setting type-textarea wide-desc">
<div class="description">' . __('<strong>Description</strong>: Enter a detailed description for the users to read on the Theme Options page, HTML is allowed. This is also where you enter content for both the Textblock & Textblock Titled option types.', 'option-tree') . '</div>
<div class="format-setting-inner">
<textarea class="textarea" rows="10" cols="40" name="' . esc_attr($name) . '[' . esc_attr($key) . '][desc]">' . (isset($setting['desc']) ? esc_html($setting['desc']) : '') . '</textarea>
</div>
</div>
</div>
<div class="format-settings">
<div class="format-setting type-textblock wide-desc">
<div class="description">' . __('<strong>Choices</strong>: This will only affect the following option types: Checkbox, Radio, Select & Select Image.', 'option-tree') . '</div>
<div class="format-setting-inner">
<ul class="option-tree-setting-wrap option-tree-sortable" data-name="' . esc_attr($name) . '[' . esc_attr($key) . ']">
' . (isset($setting['choices']) ? ot_loop_through_choices($name . '[' . $key . ']', $setting['choices']) : '') . '
</ul>
<a href="javascript:void(0);" class="option-tree-choice-add option-tree-ui-button hug-left">' . __('Add Choice', 'option-tree') . '</a>
</div>
</div>
</div>
<div class="format-settings">
<div class="format-setting type-textblock wide-desc">
<div class="description">' . __('<strong>Settings</strong>: This will only affect the List Item option type.', 'option-tree') . '</div>
<div class="format-setting-inner">
<ul class="option-tree-setting-wrap option-tree-sortable" data-name="' . esc_attr($name) . '[' . esc_attr($key) . ']">
' . (isset($setting['settings']) ? ot_loop_through_sub_settings($name . '[' . $key . '][settings]', $setting['settings']) : '') . '
</ul>
<a href="javascript:void(0);" class="option-tree-list-item-setting-add option-tree-ui-button hug-left">' . __('Add Setting', 'option-tree') . '</a>
</div>
</div>
</div>
<div class="format-settings">
<div class="format-setting type-text wide-desc">
<div class="description">' . __('<strong>Standard</strong>: Setting the standard value for your option only works for some option types. Read the <code>OptionTree->Documentation</code> for more information on which ones.', 'option-tree') . '</div>
<div class="format-setting-inner">
' . $std_form_element . '
</div>
</div>
</div>
<div class="format-settings">
<div class="format-setting type-text wide-desc">
<div class="description">' . __('<strong>Rows</strong>: Enter a numeric value for the number of rows in your textarea. This will only affect the following option types: CSS, Textarea, & Textarea Simple.', 'option-tree') . '</div>
<div class="format-setting-inner">
<input type="text" name="' . esc_attr($name) . '[' . esc_attr($key) . '][rows]" value="' . (isset($setting['rows']) ? esc_attr($setting['rows']) : '') . '" class="widefat option-tree-ui-input" />
</div>
</div>
</div>
<div class="format-settings">
//.........这里部分代码省略.........