function theme_widget_expand_control($id) { global $wp_registered_widget_controls; if (theme_is_vmenu_widget($id)) { return; } $controls =& $wp_registered_widget_controls[$id]; $controls['params'][] = $id; if (isset($controls['callback'])) { $controls['callback_redirect'] = $controls['callback']; } $controls['callback'] = 'theme_widget_extra_control'; }
function theme_get_widget_style($id, $style = null) { if (theme_is_vmenu_widget($id)) { return 'vmenu'; } $result = 'default'; if ($style != null) { if (!in_array($style, array('block', 'post', 'simple'))) { $style = 'block'; } if ($result == 'default') { $result = $style; } } return $result; }
function theme_widget_extra_control() { global $wp_registered_widget_controls, $theme_widgets_style, $theme_widget_meta_options; $_theme_widget_meta_options = $theme_widget_meta_options; $params = func_get_args(); $widget_id = $params[count($params) - 1]; $widget_controls = theme_get_array_value($wp_registered_widget_controls, $widget_id, array()); if (isset($widget_controls['callback_redirect'])) { $callback = $widget_controls['callback_redirect']; if (is_callable($callback)) { call_user_func_array($callback, $params); } } if (!preg_match('/^(.*[^-])-([0-9]+)$/', $widget_id, $matches) || !isset($matches[1]) || !isset($matches[2])) { return false; } $id = $matches[1] . '-' . $params[0]['number']; if (theme_is_vmenu_widget($id)) { $need_delete = false; foreach ($_theme_widget_meta_options as $option_id => $option) { if ($option['id'] == 'theme_widget_styles') { $need_delete = true; break; } } if ($need_delete) { unset($_theme_widget_meta_options[$option_id]); } } ?> <h3 style="margin-bottom:3px;"><?php _e('Theme Options', THEME_NS); ?> </h3> <?php theme_print_meta_box($id, $_theme_widget_meta_options); }