本文整理汇总了PHP中optionsframework_mlu_get_silentpost函数的典型用法代码示例。如果您正苦于以下问题:PHP optionsframework_mlu_get_silentpost函数的具体用法?PHP optionsframework_mlu_get_silentpost怎么用?PHP optionsframework_mlu_get_silentpost使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了optionsframework_mlu_get_silentpost函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: optionsframework_medialibrary_uploader
function optionsframework_medialibrary_uploader($_id, $_value, $_mode = 'full', $_desc = '', $_postid = 0, $_name = '')
{
$optionsframework_settings = get_option('optionsframework');
// Gets the unique option id
$option_name = $optionsframework_settings['id'];
$output = '';
$id = '';
$class = '';
$int = '';
$value = '';
$name = '';
$id = strip_tags(strtolower($_id));
// Change for each field, using a "silent" post. If no post is present, one will be created.
$int = optionsframework_mlu_get_silentpost($id);
// If a value is passed and we don't have a stored value, use the value that's passed through.
if ($_value != '' && $value == '') {
$value = $_value;
}
if ($_name != '') {
$name = $option_name . '[' . $id . '][' . $_name . ']';
} else {
$name = $option_name . '[' . $id . ']';
}
if ($value) {
$class = ' has-file';
}
$output .= '<input id="' . $id . '" class="upload' . $class . '" type="text" name="' . $name . '" value="' . $value . '" />' . "\n";
if (function_exists('wp_enqueue_media')) {
if ($value == '') {
$output .= '<input id="upload-' . $id . '" class="upload-button button" type="button" value="' . __('Upload', 'textdomain') . '" />' . "\n";
} else {
$output .= '<input id="remove-' . $id . '" class="remove-file button" type="button" value="' . __('Remove', 'textdomain') . '" />' . "\n";
}
} else {
$output .= '<p><i>' . __('Upgrade your version of WordPress for full media support.', 'textdomain') . '</i></p>';
}
if ($_desc != '') {
$output .= '<span class="of_metabox_desc">' . $_desc . '</span>' . "\n";
}
$output .= '<div class="screenshot" id="' . $id . '_image">' . "\n";
if ($value != '') {
//$remove = '<a href="javascript:(void);" class="mlu_remove button">Remove</a>';
$image = preg_match('/(^.*\\.jpg|jpeg|png|gif|ico*)/i', $value);
if ($image) {
$output .= '<img src="' . $value . '" alt="" />';
} else {
$parts = explode("/", $value);
for ($i = 0; $i < sizeof($parts); ++$i) {
$title = $parts[$i];
}
// No output preview if it's not an image.
$output .= '';
// Standard generic output if it's not an image.
$title = theme_locals("view_file");
$output .= '<div class="no_image"><span class="file_link"><a href="' . $value . '" target="_blank" rel="external">' . $title . '</a></span>' . $remove . '</div>';
}
}
$output .= '</div>' . "\n";
return $output;
}
示例2: optionsframework_medialibrary_uploader
function optionsframework_medialibrary_uploader($_id, $_value, $_mode = 'full', $_desc = '', $_postid = 0, $_name = '')
{
$optionsframework_settings = get_option('optionsframework');
// Obtiene un id único de opciones
$option_name = $optionsframework_settings['id'];
$output = '';
$id = '';
$class = '';
$int = '';
$value = '';
$name = '';
$id = strip_tags(strtolower($_id));
// Cambia para cada campo, usando una entrada "silenciosa". Si no hay una entrada presente, una será creada.
$int = optionsframework_mlu_get_silentpost($id);
// Si un valor el proporcionado y no tenemos un valor guardado, usa el valor que ha sido proporcionado.
if ($_value != '' && $value == '') {
$value = $_value;
}
if ($_name != '') {
$name = $option_name . '[' . $id . '][' . $_name . ']';
} else {
$name = $option_name . '[' . $id . ']';
}
if ($value) {
$class = ' has-file';
}
$output .= '<input id="' . $id . '" class="upload' . $class . '" type="text" name="' . $name . '" value="' . $value . '" />' . "\n";
$output .= '<input id="upload_' . $id . '" class="upload_button button" type="button" value="' . __('Subir', 'optionsframework') . '" rel="' . $int . '" />' . "\n";
if ($_desc != '') {
$output .= '<span class="of_metabox_desc">' . $_desc . '</span>' . "\n";
}
$output .= '<div class="screenshot" id="' . $id . '_image">' . "\n";
if ($value != '') {
$remove = '<a href="javascript:(void);" class="mlu_remove button">Eliminar</a>';
$image = preg_match('/(^.*\\.jpg|jpeg|png|gif|ico*)/i', $value);
if ($image) {
$output .= '<img src="' . $value . '" alt="" />' . $remove . '';
} else {
$parts = explode("/", $value);
for ($i = 0; $i < sizeof($parts); ++$i) {
$title = $parts[$i];
}
// No hay previsualización si no existe una imagen.
$output .= '';
// Salida estándar si no es una imagen.
$title = __('Ver archivo', 'optionsframework');
$output .= '<div class="no_image"><span class="file_link"><a href="' . $value . '" target="_blank" rel="external">' . $title . '</a></span>' . $remove . '</div>';
}
}
$output .= '</div>' . "\n";
return $output;
}
示例3: optionsframework_machine
//.........这里部分代码省略.........
}
$fold = '';
if (array_key_exists("folds", $value)) {
$fold = "fld ";
}
$output .= '<input type="hidden" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
$output .= '<input type="checkbox" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
break;
//multiple checkbox option
//multiple checkbox option
case 'multicheck':
isset($smof_data[$value['id']]) ? $multi_stored = $smof_data[$value['id']] : ($multi_stored = "");
foreach ($value['options'] as $key => $option) {
if (!isset($multi_stored[$key])) {
$multi_stored[$key] = '';
}
$of_key_string = $value['id'] . '_' . $key;
$output .= '<input type="checkbox" class="checkbox of-input" name="' . $value['id'] . '[' . $key . ']' . '" id="' . $of_key_string . '" value="1" ' . checked($multi_stored[$key], 1, false) . ' /><label class="multicheck" for="' . $of_key_string . '">' . $option . '</label><br />';
}
break;
//ajax image upload option
//ajax image upload option
case 'upload':
if (!isset($value['mod'])) {
$value['mod'] = '';
}
$output .= Options_Machine::optionsframework_uploader_function($value['id'], $value['std'], $value['mod']);
break;
// native media library uploader - @uses optionsframework_media_uploader_function()
// native media library uploader - @uses optionsframework_media_uploader_function()
case 'media':
$_id = strip_tags(strtolower($value['id']));
$int = '';
$int = optionsframework_mlu_get_silentpost($_id);
if (!isset($value['mod'])) {
$value['mod'] = '';
}
$output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $value['std'], $int, $value['mod']);
// New AJAX Uploader using Media Library
break;
//colorpicker option
//colorpicker option
case 'color':
$output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div style="background-color: ' . $smof_data[$value['id']] . '"></div></div>';
$output .= '<input class="of-color" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . $smof_data[$value['id']] . '" />';
break;
//typography option
//typography option
case 'typography':
$typography_stored = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
/* Font Size */
if (isset($typography_stored['size'])) {
$output .= '<div class="select_wrapper typography-size" original-title="Font size">';
$output .= '<select class="of-typography of-typography-size select" name="' . $value['id'] . '[size]" id="' . $value['id'] . '_size">';
for ($i = 9; $i < 101; $i++) {
$test = $i . 'px';
$output .= '<option value="' . $i . 'px" ' . selected($typography_stored['size'], $test, false) . '>' . $i . 'px</option>';
}
$output .= '</select></div>';
}
/* Line Height */
if (isset($typography_stored['height'])) {
$output .= '<div class="select_wrapper typography-height" original-title="Line height">';
$output .= '<select class="of-typography of-typography-height select" name="' . $value['id'] . '[height]" id="' . $value['id'] . '_height">';
for ($i = 20; $i < 38; $i++) {
$test = $i . 'px';
示例4: optionsframework_machine
//.........这里部分代码省略.........
}
$fold = '';
if (array_key_exists("folds", $value)) {
$fold = "fld ";
}
$output .= '<input type="hidden" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
$output .= '<input type="checkbox" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
break;
//multiple checkbox option
//multiple checkbox option
case 'multicheck':
isset($smof_data[$value['id']]) ? $multi_stored = $smof_data[$value['id']] : ($multi_stored = "");
foreach ($value['options'] as $key => $option) {
if (!isset($multi_stored[$key])) {
$multi_stored[$key] = '';
}
$of_key_string = $value['id'] . '_' . $key;
$output .= '<input type="checkbox" class="checkbox of-input" name="' . $value['id'] . '[' . $key . ']' . '" id="' . $of_key_string . '" value="1" ' . checked($multi_stored[$key], 1, false) . ' /><label class="multicheck" for="' . $of_key_string . '">' . $option . '</label><br />';
}
break;
//ajax image upload option
//ajax image upload option
case 'upload':
if (!isset($value['mod'])) {
$value['mod'] = '';
}
$output .= Options_Machine::optionsframework_uploader_function($value['id'], $value['std'], $value['mod']);
break;
// native media library uploader - @uses optionsframework_media_uploader_function()
// native media library uploader - @uses optionsframework_media_uploader_function()
case 'media':
$_id = strip_tags(strtolower($value['id']));
$int = '';
$int = optionsframework_mlu_get_silentpost($_id);
if (!isset($value['mod'])) {
$value['mod'] = '';
}
$output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $value['std'], $int, $value['mod']);
// New AJAX Uploader using Media Library
break;
//colorpicker option
//colorpicker option
case 'color':
$_color = !empty($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
$output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div style="background-color: ' . $_color . '"></div></div>';
$output .= '<input class="of-color" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . $_color . '" />';
break;
//typography option
//typography option
case 'typography':
$typography_stored = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
/* Font Size */
if (isset($typography_stored['size'])) {
$output .= '<div class="select_wrapper typography-size" original-title="Font size">';
$output .= '<select class="of-typography of-typography-size select" name="' . $value['id'] . '[size]" id="' . $value['id'] . '_size">';
for ($i = 9; $i < 20; $i++) {
$test = $i . 'px';
$output .= '<option value="' . $i . 'px" ' . selected($typography_stored['size'], $test, false) . '>' . $i . 'px</option>';
}
$output .= '</select></div>';
}
/* Line Height */
if (isset($typography_stored['height'])) {
$output .= '<div class="select_wrapper typography-height" original-title="Line height">';
$output .= '<select class="of-typography of-typography-height select" name="' . $value['id'] . '[height]" id="' . $value['id'] . '_height">';
for ($i = 20; $i < 38; $i++) {
示例5: optionsframework_medialibrary_uploader
function optionsframework_medialibrary_uploader($option_name, $type, $_id, $_value, $_mode = 'full', $_desc = null, $_postid = 0, $_name = null, $_upload_text = null)
{
$output = '';
$id = '';
$class = '';
$int = '';
$value = array('url' => '', 'id' => '');
$upload_text = __('Upload', 'themeblvd');
if ($type == 'slider') {
$name = $option_name . '[image]';
} else {
$name = $option_name . '[' . $_id . ']';
}
$id = strip_tags(strtolower($_id));
// If a value is passed and we don't have a stored value, use the value that's passed through.
if ($_value) {
$value = $_value;
}
// If passed name, set it.
if ($_name) {
$name = $name . '[' . $_name . ']';
$id = $id . '_' . $_name;
}
// Set the ID for the post.
if ($_postid) {
// Set ID to the one passed in.
$int = $_postid;
} else {
// Change for each field, using a "silent" post.
// If no post is present, one will be created.
$int = optionsframework_mlu_get_silentpost($id);
}
// If passed upload button text, set it.
if ($_upload_text) {
$upload_text = $_upload_text;
}
if ($value['url']) {
$class = ' has-file';
}
// Allow multiple upload options on the same page with
// same ID -- This could happen in the Layout Builder, for example.
$formfield = uniqid($id . '_');
if ($type == 'slider') {
// Slider image ID input w/hidden image URL input for user admin display
$output .= '<span class="locked"><span></span><input id="' . $formfield . '_id" class="locked upload' . $class . '" type="text" name="' . $name . '[id]" value="' . $value['id'] . '" /></span>' . "\n";
$output .= '<input id="' . $formfield . '" class="image-url upload' . $class . '" type="hidden" name="' . $name . '[url]" value="' . $value['url'] . '" />' . "\n";
$output .= '<p class="explain">' . __('You must use the "Get Image" button to modify the image ID for this slide. This is what the locked icon represents.', 'themeblvd') . '</p>';
} elseif ($type == 'logo') {
$width_name = str_replace('[image]', '[image_width]', $name);
$output .= '<input id="' . $formfield . '" class="image-url upload' . $class . '" type="text" name="' . $name . '" value="' . $value['url'] . '" placeholder="' . __('Image URL', 'themeblvd') . '" />' . "\n";
$output .= '<input id="' . $formfield . '_width" class="image-width upload' . $class . '" type="text" name="' . $width_name . '" value="' . $value['width'] . '" placeholder="' . __('Width', 'themeblvd') . '" />' . "\n";
} elseif ($type == 'logo_2x') {
$output .= '<input id="' . $formfield . '" class="image-url upload' . $class . '" type="text" name="' . $name . '" value="' . $value['url'] . '" placeholder="' . __('Image URL twice the size of standard image', 'themeblvd') . '" />' . "\n";
} else {
// Standard image input
$output .= '<input id="' . $formfield . '" class="image-url upload' . $class . '" type="text" name="' . $name . '" value="' . $value['url'] . '" placeholder="' . __('Image URL', 'themeblvd') . '" />' . "\n";
}
$output .= '<input id="upload_' . $formfield . '" class="upload_button button" type="button" value="' . $upload_text . '" data-upload-type="' . $type . '" rel="' . $int . '" />' . "\n";
if ($_desc != '') {
$output .= '<span class="of_metabox_desc">' . $_desc . '</span>' . "\n";
}
$output .= '<div class="screenshot" id="' . $id . '_image">' . "\n";
if ($value['url'] != '') {
$remove = '<a href="javascript:(void);" class="mlu_remove button">Remove</a>';
$image = preg_match('/(^.*\\.jpg|jpeg|png|gif|ico*)/i', $value['url']);
if ($image) {
$output .= '<img src="' . $value['url'] . '" alt="" />' . $remove . '';
} else {
$parts = explode("/", $value['url']);
for ($i = 0; $i < sizeof($parts); ++$i) {
$title = $parts[$i];
}
// No output preview if it's not an image.
$output .= '';
// Standard generic output if it's not an image.
$title = __('View File', 'themeblvd');
$output .= '<div class="no_image"><span class="file_link"><a href="' . $value['url'] . '" target="_blank" rel="external">' . $title . '</a></span>' . $remove . '</div>';
}
}
$output .= '</div>' . "\n";
return $output;
}
示例6: optionsframework_medialibrary_uploader
function optionsframework_medialibrary_uploader($_id, $_value, $_mode = 'full', $_desc = '', $_postid = 0, $_name = '')
{
/* earlier code
$optionsframework_settings = get_option($_id);
//print_r($optionsframework_settings);
// Gets the unique option id
$option_name = $optionsframework_settings['id'];
*/
/* new code*/
$option_name = get_option($_id);
/* end new code */
$output = $id = $class = $int = $name = '';
$value = get_option($_id);
$id = strip_tags(strtolower($_id));
// Change for each field, using a "silent" post. If no post is present, one will be created.
$int = optionsframework_mlu_get_silentpost($id);
// If a value is passed and we don't have a stored value, use the value that's passed through.
if ($_value != '' && $value == '') {
$value = $_value;
}
if ($_name != '') {
$name = $option_name . '[' . $id . '][' . $_name . ']';
} else {
$name = $option_name . '[' . $id . ']';
}
if ($value) {
$class = ' has-file';
}
$output .= '<input id="' . $id . '" class="upload' . $class . '" type="text" name="' . $id . '" value="' . $value . '" />' . "\n";
$output .= '<input id="upload_' . $id . '" class="upload_button button-primary button-large" type="button" value="' . __('Upload', 'optionsframework') . '" rel="' . $int . '" />' . "\n";
if ($_desc != '') {
$output .= '<span class="of_metabox_desc">' . $_desc . '</span>' . "\n";
}
$output .= '<div class="clear"></div><div class="screenshot" id="' . $id . '_image">' . "\n";
if ($value != '') {
$remove = '<a href="javascript:(void);" class="custom_clear_image_button button button-primary">x</a>';
$image = preg_match('/(^.*\\.jpg|jpeg|png|gif*)/i', $value);
if ($image) {
$image_attributes = wp_get_attachment_image_src(get_attachment_id_from_src($value));
if ($image_attributes[0] != '') {
$output .= '<img src="' . $image_attributes[0] . '" alt="" />' . $remove . '';
} else {
$output .= '<img src="' . $value . '" alt="" />' . $remove . '';
}
} else {
$parts = explode("/", $value);
for ($i = 0; $i < sizeof($parts); ++$i) {
$title = $parts[$i];
}
// No output preview if it's not an image.
$output .= '';
// Standard generic output if it's not an image.
$title = __('View File', 'optionsframework');
$output .= '<div class="no_image"><span class="file_link"></span>' . $remove . '</div>';
}
}
$output .= '</div>' . "\n";
return $output;
}
示例7: optionsframework_machine
//.........这里部分代码省略.........
}
$fold = '';
if (array_key_exists("folds", $value)) {
$fold = "fld ";
}
$output .= '<input type="hidden" class="' . $fold . 'checkbox aq-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
$output .= '<input type="checkbox" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="1" ' . checked(@$data[$value['id']], 1, false) . ' />';
break;
//multiple checkbox option
//multiple checkbox option
case 'multicheck':
$multi_stored = @$data[$value['id']];
foreach ($value['options'] as $key => $option) {
if (!isset($multi_stored[$key])) {
$multi_stored[$key] = '';
}
$of_key_string = $value['id'] . '_' . $key;
$output .= '<input type="checkbox" class="checkbox of-input" name="' . $value['id'] . '[' . $key . ']' . '" id="' . $of_key_string . '" value="1" ' . checked($multi_stored[$key], 1, false) . ' /><label class="multicheck" for="' . $of_key_string . '">' . $option . '</label><br />';
}
break;
//ajax image upload option
//ajax image upload option
case 'upload':
if (!isset($value['mod'])) {
$value['mod'] = '';
}
$output .= Options_Machine::optionsframework_uploader_function($value['id'], $value['std'], $value['mod']);
break;
// native media library uploader - @uses optionsframework_media_uploader_function()
// native media library uploader - @uses optionsframework_media_uploader_function()
case 'media':
$_id = strip_tags(strtolower($value['id']));
$int = '';
$int = optionsframework_mlu_get_silentpost($_id);
if (!isset($value['mod'])) {
$value['mod'] = '';
}
$output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $value['std'], $int, $value['mod']);
// New AJAX Uploader using Media Library
break;
//colorpicker option
//colorpicker option
case 'color':
$output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div style="background-color: ' . @$data[$value['id']] . '"></div></div>';
$output .= '<input class="of-color" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . @$data[$value['id']] . '" />';
break;
//typography option
//typography option
case 'typography':
$typography_stored = isset($data[$value['id']]) ? @$data[$value['id']] : $value['std'];
/* Font Size */
if (isset($typography_stored['size'])) {
$output .= '<div class="select_wrapper typography-size" original-title="Font size">';
$output .= '<select class="of-typography of-typography-size select" name="' . $value['id'] . '[size]" id="' . $value['id'] . '_size">';
if ($value['id'] == 'md_body_fontsize') {
$mini = '10';
$maxi = '21';
} else {
$mini = '28';
$maxi = '72';
}
for ($i = $mini; $i < $maxi; $i++) {
$test = $i . 'px';
$output .= '<option value="' . $i . 'px" ' . selected($typography_stored['size'], $test, false) . '>' . $i . 'px</option>';
}
$output .= '</select></div>';
示例8: optionsframework_machine
//.........这里部分代码省略.........
$fold = '';
if (array_key_exists("folds", $value)) {
$fold = "fld ";
}
$output .= '<input type="hidden" class="' . $fold . 'checkbox aq-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
$output .= '<input type="checkbox" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="1" ' . checked($data[$value['id']], 1, false) . ' />';
break;
//multiple checkbox option
//multiple checkbox option
case 'multicheck':
//$multi_stored = $data[$value['id']];
isset($data[$value['id']]) ? $multi_stored = $data[$value['id']] : ($multi_stored = "");
foreach ($value['options'] as $key => $option) {
if (!isset($multi_stored[$key])) {
$multi_stored[$key] = '';
}
$of_key_string = $value['id'] . '_' . $key;
$output .= '<input type="checkbox" class="checkbox of-input" name="' . $value['id'] . '[' . $key . ']' . '" id="' . $of_key_string . '" value="1" ' . checked($multi_stored[$key], 1, false) . ' /><label class="multicheck" for="' . $of_key_string . '">' . $option . '</label><br />';
}
break;
//ajax image upload option
//ajax image upload option
case 'upload':
if (!isset($value['mod'])) {
$value['mod'] = '';
}
$output .= Options_Machine::optionsframework_uploader_function($value['id'], $value['std'], $value['mod']);
break;
// native media library uploader - @uses optionsframework_media_uploader_function()
// native media library uploader - @uses optionsframework_media_uploader_function()
case 'media':
$_id = strip_tags(strtolower($value['id']));
$int = '';
$int = optionsframework_mlu_get_silentpost($_id);
if (!isset($value['mod'])) {
$value['mod'] = '';
}
$output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $value['std'], $int, $value['mod']);
// New AJAX Uploader using Media Library
break;
//colorpicker option
//colorpicker option
case 'color':
$output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div style="background-color: ' . $data[$value['id']] . '"></div></div>';
$output .= '<input class="of-color" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . $data[$value['id']] . '" />';
break;
//typography option
//typography option
case 'typography':
$typography_stored = isset($data[$value['id']]) ? $data[$value['id']] : $value['std'];
/* Font Size */
if (isset($typography_stored['size'])) {
$output .= '<div class="select_wrapper typography-size" original-title="Font size">';
$output .= '<select class="of-typography of-typography-size select" name="' . $value['id'] . '[size]" id="' . $value['id'] . '_size">';
for ($i = 9; $i < 47; $i++) {
$test = $i . 'px';
$output .= '<option value="' . $i . 'px" ' . selected($typography_stored['size'], $test, false) . '>' . $i . 'px</option>';
}
$output .= '</select></div>';
}
/* Line Height */
if (isset($typography_stored['height'])) {
$output .= '<div class="select_wrapper typography-height" original-title="Line height">';
$output .= '<select class="of-typography of-typography-height select" name="' . $value['id'] . '[height]" id="' . $value['id'] . '_height">';
for ($i = 20; $i < 38; $i++) {
$test = $i . 'px';
示例9: optionsframework_machine
//.........这里部分代码省略.........
if (!isset($pmc_data[$value['id']])) {
$pmc_data[$value['id']] = '';
}
$output .= '<input type="checkbox" class="checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="1" ' . checked($pmc_data[$value['id']], true, false) . ' />';
break;
case 'multicheck':
if (!isset($pmc_data[$value['id']])) {
$pmc_data[$value['id']] = '';
}
$multi_stored = $pmc_data[$value['id']];
foreach ($value['options'] as $key => $option) {
if (!isset($multi_stored[$key])) {
$multi_stored[$key] = '';
}
$of_key_string = $value['id'] . '_' . $key;
$output .= '<input type="checkbox" class="checkbox of-input" name="' . $value['id'] . '[' . $key . ']' . '" id="' . $of_key_string . '" value="1" ' . checked($multi_stored[$key], 1, false) . ' /><label for="' . $of_key_string . '">' . $option . '</label><br />';
}
break;
case 'upload':
if (!isset($pmc_data[$value['id']])) {
$pmc_data[$value['id']] = '';
}
if (!isset($value['mod'])) {
$value['mod'] = '';
}
$output .= Options_Machine::optionsframework_uploader_function($value['id'], $value['std'], $value['mod']);
break;
case 'media':
if (!isset($pmc_data[$value['id']])) {
$pmc_data[$value['id']] = '';
}
$_id = strip_tags(strtolower($value['id']));
$int = '';
$int = optionsframework_mlu_get_silentpost($_id);
if (!isset($value['mod'])) {
$value['mod'] = '';
}
$output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $value['std'], $int, $value['mod']);
// New AJAX Uploader using Media Library
break;
case 'slider':
if (!isset($pmc_data[$value['id']])) {
$pmc_data[$value['id']] = '';
}
$_id = strip_tags(strtolower($value['id']));
$int = '';
$int = optionsframework_mlu_get_silentpost($_id);
$output .= '<div class="slider"><ul id="' . $value['id'] . '" rel="' . $int . '">';
$slides = $pmc_data[$value['id']];
$count = count($slides);
if ($count < 2) {
$oldorder = 1;
$order = 1;
$output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int, $value['descshow'], $value['team'], $value['nivo']);
} else {
$i = 0;
foreach ($slides as $slide) {
if (isset($slide['order'])) {
$oldorder = $slide['order'];
} else {
$oldorder = 0;
}
$i++;
$order = $i;
$output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int, $value['descshow'], $value['team'], $value['nivo']);
}
示例10: Inputs
//.........这里部分代码省略.........
//multiple checkbox option
case 'multicheck':
//(isset($smof_data[$value['id']]))? $multi_stored = $smof_data[$value['id']] : $multi_stored="";
$multi_stored = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : (isset($value['std']) ? $value['std'] : '');
foreach ($value['options'] as $key => $option) {
if (is_array($multi_stored)) {
if (isset($value['keyAsValue']) && $value['keyAsValue'] === true) {
$check_this = in_array($key, $multi_stored) ? $key : '';
} else {
$check_this = isset($multi_stored[$key]) ? $multi_stored[$key] : '';
}
} else {
$check_this = $multi_stored;
}
$of_key_string = $value['id'] . '_' . $key;
$_val = isset($value['keyAsValue']) && $value['keyAsValue'] === true ? $key : '1';
$output .= '<input type="checkbox" class="checkbox of-input" name="' . esc_attr($value['id']) . '[' . esc_attr($key) . ']' . '" id="' . esc_attr($of_key_string) . '" value="' . esc_attr($_val) . '" ' . checked($check_this, $_val, false) . ' /><label class="multicheck" for="' . esc_attr($of_key_string) . '">' . $option . '</label><br />';
}
//$output .= '<pre>'.print_r($multi_stored, true).'</pre>'; // debug
break;
//ajax image upload option
//ajax image upload option
case 'upload':
if (!isset($value['mod'])) {
$value['mod'] = '';
}
$output .= Options_Machine::optionsframework_uploader_function($value['id'], $value['std'], $value['mod']);
break;
// native media library uploader - @uses optionsframework_media_uploader_function()
// native media library uploader - @uses optionsframework_media_uploader_function()
case 'media':
$_id = strip_tags(strtolower($value['id']));
$int = '';
$int = optionsframework_mlu_get_silentpost($_id);
if (!isset($value['mod'])) {
$value['mod'] = '';
}
$output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $value['std'], $int, $value['mod']);
// New AJAX Uploader using Media Library
break;
//colorpicker option
//colorpicker option
case 'color':
$color_stored = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
$output .= '<div id="' . esc_attr($value['id']) . '_picker" class="colorSelector"><div style="background-color: ' . esc_attr($color_stored) . '"></div></div>';
$output .= '<input class="of-color" name="' . esc_attr($value['id']) . '" id="' . esc_attr($value['id']) . '" type="text" value="' . esc_attr($color_stored) . '" />';
break;
//select option
//select option
case 'select_color_scheme':
$mini = '';
if (!isset($value['mod'])) {
$value['mod'] = '';
}
if (!isset($value['fields']) || !is_array($value['fields'])) {
$value['fields'] = array();
}
if ($value['mod'] == 'mini') {
$mini = 'mini';
}
$output .= '<div class="select_wrapper ' . esc_attr($mini) . '">';
$output .= '<select class="select of-input select-color-scheme" name="' . esc_attr($value['id']) . '" id="' . esc_attr($value['id']) . '">';
$selected_option = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : (isset($value['std']) ? $value['std'] : "");
foreach ($value['options'] as $select_ID => $option) {
$select_ID = !isset($select_ID) ? $option : $select_ID;
$output .= '<option id="' . esc_attr($select_ID) . '" value="' . esc_attr($select_ID) . '" ' . selected($selected_option, $select_ID, false) . ' />' . $option . '</option>';
示例11: optionsframework_medialibrary_uploader
function optionsframework_medialibrary_uploader($_id, $_value, $_mode = 'full', $_desc = '', $_postid = 0, $_name = '')
{
$optionsframework_settings = get_option('optionsframework');
// Gets the unique option id
$option_name = $optionsframework_settings['id'];
$output = '';
$id = '';
$class = '';
$int = '';
$value = '';
$name = '';
$att_id = 0;
$id = strip_tags(strtolower($_id));
// Change for each field, using a "silent" post. If no post is present, one will be created.
$int = optionsframework_mlu_get_silentpost($id);
// If a value is passed and we don't have a stored value, use the value that's passed through.
if ($_mode == 'with_id') {
$value = !empty($_value[0]) ? $_value[0] : '';
$att_id = !empty($_value[1]) ? intval($_value[1]) : 0;
} elseif ($_value != '' && $value == '') {
$value = $_value;
}
if ($_name != '') {
$name = $option_name . '[' . $id . '][' . $_name . ']';
} else {
$name = $option_name . '[' . $id . ']';
}
if ($value) {
$class = ' has-file';
}
if ($_mode == 'with_id') {
$output .= '<input id="' . $id . '" class="upload' . $class . '" type="text" name="' . $name . '[uri]" value="' . $value . '" />' . "\n";
$output .= '<input type="hidden" class="upload-id" name="' . $name . '[id]" value="' . $att_id . '" />' . "\n";
} else {
$output .= '<input id="' . $id . '" class="upload' . $class . '" type="text" name="' . $name . '" value="' . $value . '" />' . "\n";
}
$output .= '<input id="upload_' . $id . '" class="upload_button button" type="button" value="' . _x('Upload', 'backend', LANGUAGE_ZONE) . '" rel="' . $int . '" />' . "\n";
if ($_desc != '') {
$output .= '<span class="of_metabox_desc">' . $_desc . '</span>' . "\n";
}
$output .= '<div class="screenshot" id="' . $id . '_image">' . "\n";
if ($value != '') {
$remove = '<a href="javascript:(void);" class="mlu_remove button">Remove</a>';
$image = preg_match('/(^.*\\.jpg|jpeg|png|gif|ico*)/i', $value);
if ($image) {
$value = dt_get_of_uploaded_image($value);
$output .= '<img src="' . $value . '" alt="" />' . $remove . '';
} else {
$parts = explode("/", $value);
for ($i = 0; $i < sizeof($parts); ++$i) {
$title = $parts[$i];
}
// No output preview if it's not an image.
$output .= '';
// Standard generic output if it's not an image.
$title = _x('View File', 'backend', LANGUAGE_ZONE);
$output .= '<div class="no_image"><span class="file_link"><a href="' . $value . '" target="_blank" rel="external">' . $title . '</a></span>' . $remove . '</div>';
}
}
$output .= '</div>' . "\n";
return $output;
}
示例12: optionsframework_machine
//.........这里部分代码省略.........
}
$fold = '';
if (array_key_exists("folds", $value)) {
$fold = "fld ";
}
$output .= '<input type="hidden" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
$output .= '<input type="checkbox" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
break;
//multiple checkbox option
//multiple checkbox option
case 'multicheck':
isset($smof_data[$value['id']]) ? $multi_stored = $smof_data[$value['id']] : ($multi_stored = "");
foreach ($value['options'] as $key => $option) {
if (!isset($multi_stored[$key])) {
$multi_stored[$key] = '';
}
$of_key_string = $value['id'] . '_' . $key;
$output .= '<input type="checkbox" class="checkbox of-input" name="' . $value['id'] . '[' . $key . ']' . '" id="' . $of_key_string . '" value="1" ' . checked($multi_stored[$key], 1, false) . ' /><label class="multicheck" for="' . $of_key_string . '">' . $option . '</label><br />';
}
break;
//ajax image upload option
//ajax image upload option
case 'upload':
if (!isset($value['mod'])) {
$value['mod'] = '';
}
$output .= Options_Machine::optionsframework_uploader_function($value['id'], $value['std'], $value['mod']);
break;
// native media library uploader - @uses optionsframework_media_uploader_function()
// native media library uploader - @uses optionsframework_media_uploader_function()
case 'media':
$_id = strip_tags(strtolower($value['id']));
$int = '';
$int = optionsframework_mlu_get_silentpost($_id);
if (!isset($value['mod'])) {
$value['mod'] = '';
}
$output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $value['std'], $int, $value['mod']);
// New AJAX Uploader using Media Library
break;
//colorpicker option
//colorpicker option
case 'color':
$output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div style="background-color: ' . $smof_data[$value['id']] . '"></div></div>';
$output .= '<input class="of-color" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . $smof_data[$value['id']] . '" />';
break;
//typography option
//typography option
case 'typography':
$typography_stored = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
/* Font Size */
if (isset($typography_stored['size'])) {
$output .= '<div class="select_wrapper typography-size" original-title="Font size">';
$output .= '<select class="of-typography of-typography-size select" name="' . $value['id'] . '[size]" id="' . $value['id'] . '_size">';
for ($i = 9; $i <= 72; $i++) {
$test = $i . 'px';
$output .= '<option value="' . $i . 'px" ' . selected($typography_stored['size'], $test, false) . '>' . $i . 'px</option>';
}
$output .= '</select></div>';
}
/* Line Height */
if (isset($typography_stored['height'])) {
$output .= '<div class="select_wrapper typography-height" original-title="Line height">';
$output .= '<select class="of-typography of-typography-height select" name="' . $value['id'] . '[height]" id="' . $value['id'] . '_height">';
for ($i = 20; $i < 38; $i++) {
$test = $i . 'px';
示例13: optionsframework_machine
//.........这里部分代码省略.........
}
$fold = '';
if (array_key_exists("folds", $value)) {
$fold = "fld ";
}
$output .= '<input type="hidden" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
$output .= '<input type="checkbox" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="1" ' . checked($ish_options[$value['id']], 1, false) . ' />';
break;
//multiple checkbox option
//multiple checkbox option
case 'multicheck':
isset($ish_options[$value['id']]) ? $multi_stored = $ish_options[$value['id']] : ($multi_stored = "");
foreach ($value['options'] as $key => $option) {
if (!isset($multi_stored[$key])) {
$multi_stored[$key] = '';
}
$of_key_string = $value['id'] . '_' . $key;
$output .= '<input type="checkbox" class="checkbox of-input" name="' . $value['id'] . '[' . $key . ']' . '" id="' . $of_key_string . '" value="1" ' . checked($multi_stored[$key], 1, false) . ' /><label class="multicheck" for="' . $of_key_string . '">' . $option . '</label><br />';
}
break;
//ajax image upload option
//ajax image upload option
case 'upload':
if (!isset($value['mod'])) {
$value['mod'] = '';
}
$output .= Options_Machine::optionsframework_uploader_function($value['id'], $value['std'], $value['mod']);
break;
// native media library uploader - @uses optionsframework_media_uploader_function()
// native media library uploader - @uses optionsframework_media_uploader_function()
case 'media':
$_id = strip_tags(strtolower($value['id']));
$int = '';
$int = optionsframework_mlu_get_silentpost($_id);
if (!isset($value['mod'])) {
$value['mod'] = '';
}
$output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $value['std'], $int, $value['mod']);
// New AJAX Uploader using Media Library
break;
//colorpicker option
//colorpicker option
case 'color':
// Updated by IshYoBoy
$def = isset($ish_options[$value['id']]) ? $ish_options[$value['id']] : $defaults[$value['id']];
$output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div style="background-color: ' . $def . '"></div></div>';
$output .= '<input class="of-color" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . $def . '" />';
break;
//typography option
//typography option
case 'typography':
$typography_stored = isset($ish_options[$value['id']]) ? $ish_options[$value['id']] : $value['std'];
/* Font Size */
if (isset($typography_stored['size'])) {
$output .= '<div class="select_wrapper typography-size" original-title="Font size">';
$output .= '<select class="of-typography of-typography-size select" name="' . $value['id'] . '[size]" id="' . $value['id'] . '_size">';
for ($i = 9; $i < 20; $i++) {
$test = $i . 'px';
$output .= '<option value="' . $i . 'px" ' . selected($typography_stored['size'], $test, false) . '>' . $i . 'px</option>';
}
$output .= '</select></div>';
}
/* Line Height */
if (isset($typography_stored['height'])) {
$output .= '<div class="select_wrapper typography-height" original-title="Line height">';
$output .= '<select class="of-typography of-typography-height select" name="' . $value['id'] . '[height]" id="' . $value['id'] . '_height">';
示例14: optionsframework_machine
/**
* Process options data and build option fields
*/
public static function optionsframework_machine($options)
{
$data = get_option(OPTIONS);
$defaults = array();
$counter = 0;
$menu = '';
$output = '';
foreach ($options as $value) {
$counter++;
$val = '';
//create array of defaults
if ($value['type'] == 'multicheck') {
if (is_array($value['std'])) {
foreach ($value['std'] as $i => $key) {
$defaults[$value['id']][$key] = true;
}
} else {
$defaults[$value['id']][$value['std']] = true;
}
} else {
if (isset($value['id'])) {
$defaults[$value['id']] = $value['std'];
}
}
//Start Heading
if ($value['type'] != "heading") {
$class = '';
if (isset($value['class'])) {
$class = $value['class'];
}
//hide items in checkbox group
$fold = '';
if (array_key_exists("fold", $value)) {
if ($data[$value['fold']]) {
$fold = "f_" . $value['fold'] . " ";
} else {
$fold = "f_" . $value['fold'] . " temphide ";
}
}
$output .= '<div id="section-' . $value['id'] . '" class="' . $fold . 'section section-' . $value['type'] . ' ' . $class . '">' . "\n";
//only show header if 'name' value exists
if ($value['name']) {
$output .= '<h3 class="heading">' . $value['name'] . '</h3>' . "\n";
}
$output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
}
//End Heading
//switch statement to handle various options type
switch ($value['type']) {
//text input
case 'text':
$t_value = '';
$t_value = stripslashes($data[$value['id']]);
$mini = '';
if (!isset($value['mod'])) {
$value['mod'] = '';
}
if ($value['mod'] == 'mini') {
$mini = 'mini';
}
$output .= '<input class="of-input ' . $mini . '" name="' . $value['id'] . '" id="' . $value['id'] . '" type="' . $value['type'] . '" value="' . $t_value . '" />';
break;
//ajax image upload option
//ajax image upload option
case 'upload':
if (!isset($value['mod'])) {
$value['mod'] = '';
}
$output .= Options_Machine::optionsframework_uploader_function($value['id'], $value['std'], $value['mod']);
break;
// native media library uploader - @uses optionsframework_media_uploader_function()
// native media library uploader - @uses optionsframework_media_uploader_function()
case 'media':
$_id = strip_tags(strtolower($value['id']));
$int = '';
$int = optionsframework_mlu_get_silentpost($_id);
if (!isset($value['mod'])) {
$value['mod'] = '';
}
$output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $value['std'], $int, $value['mod']);
// New AJAX Uploader using Media Library
break;
//display a single image
//display a single image
case "image":
$src = $value['std'];
$output .= '<img src="' . $src . '">';
break;
//select option
//select option
case 'select':
$mini = '';
if (!isset($value['mod'])) {
$value['mod'] = '';
}
if ($value['mod'] == 'mini') {
$mini = 'mini';
//.........这里部分代码省略.........
示例15: optionsframework_machine
//.........这里部分代码省略.........
}
$fold = '';
if (array_key_exists("folds", $value)) {
$fold = "fld ";
}
$output .= '<input type="hidden" class="' . $fold . 'checkbox aq-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
$output .= '<input type="checkbox" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="1" ' . checked($data[$value['id']], 1, false) . ' />';
break;
//multiple checkbox option
//multiple checkbox option
case 'multicheck':
$multi_stored = $data[$value['id']];
foreach ($value['options'] as $key => $option) {
if (!isset($multi_stored[$key])) {
$multi_stored[$key] = '';
}
$of_key_string = $value['id'] . '_' . $key;
$output .= '<input type="checkbox" class="checkbox of-input" name="' . $value['id'] . '[' . $key . ']' . '" id="' . $of_key_string . '" value="1" ' . checked($multi_stored[$key], 1, false) . ' /><label class="multicheck" for="' . $of_key_string . '">' . $option . '</label><br />';
}
break;
//ajax image upload option
//ajax image upload option
case 'upload':
if (!isset($value['mod'])) {
$value['mod'] = '';
}
$output .= Options_Machine::optionsframework_uploader_function($value['id'], $value['std'], $value['mod']);
break;
// native media library uploader - @uses optionsframework_media_uploader_function()
// native media library uploader - @uses optionsframework_media_uploader_function()
case 'media':
$_id = strip_tags(strtolower($value['id']));
$int = '';
$int = optionsframework_mlu_get_silentpost($_id);
if (!isset($value['mod'])) {
$value['mod'] = '';
}
$output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $value['std'], $int, $value['mod']);
// New AJAX Uploader using Media Library
break;
//colorpicker option
//colorpicker option
case 'color':
$output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div style="background-color: ' . $data[$value['id']] . '"></div></div>';
$output .= '<input class="of-color" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . $data[$value['id']] . '" />';
break;
//typography option
//typography option
case 'typography':
$typography_stored = isset($data[$value['id']]) ? $data[$value['id']] : $value['std'];
/* Font Size */
if (isset($typography_stored['size'])) {
$output .= '<div class="select_wrapper typography-size" original-title="Font size">';
$output .= '<select class="of-typography of-typography-size select" name="' . $value['id'] . '[size]" id="' . $value['id'] . '_size">';
for ($i = 9; $i < 35; $i++) {
$test = $i . 'px';
$output .= '<option value="' . $i . 'px" ' . selected($typography_stored['size'], $test, false) . '>' . $i . 'px</option>';
}
$output .= '</select></div>';
}
/* Line Height */
if (isset($typography_stored['height'])) {
$output .= '<div class="select_wrapper typography-height" original-title="Line height">';
$output .= '<select class="of-typography of-typography-height select" name="' . $value['id'] . '[height]" id="' . $value['id'] . '_height">';
for ($i = 20; $i < 40; $i++) {
$test = $i . 'px';